Dart/Flutter Web unit testing errors: Error: Not found: ‘dart:html’
I had a similar issue while developing for a mobile app, but it turned out that I imported the package dart.html accidentally. I just removed it and I was able to run the program.
I had a similar issue while developing for a mobile app, but it turned out that I imported the package dart.html accidentally. I just removed it and I was able to run the program.
Make sure that the import is set to this: import ‘package:test/test.dart’; instead of this: import ‘package:flutter_test/flutter_test.dart’;
If you get the message: Because every version of flutter_test from sdk depends on… It means flutter_test depends on a dependency with version lower than you specified in another dependency. To solve this, open pubspec.yaml, and remove the version number of the problem dependency: Example: Change archive: ^2.0.13 –> remove this number To: archive:
You can run any file from any DIR provided that you set the target file path, example: flutter run -t lib/main_dev.dart OR flutter run lib/dev/main_dev.dart UPDATE (2020 February 5th) It is however not advisable to remove main.dart from your project. I’m sure most of you found this link because you are setting up / configuring … Read more
As Jonah Williams said, If you changed MyApp from a StatelessWidget to a StatefulWidget you need to hot restart, since it is invoked in main This has been explained multiple times in live coding sessions, that when you make changes in functions like initState(), you have to restart the app. A similar case applies for … Read more
You need to wrap your widget with the MediaQuery(…) instance, and because you are using Scaffold(..) you must wrap it in a MaterialApp(..) Read more about MediaQuery Example: Widget testWidget = new MediaQuery( data: new MediaQueryData(), child: new MaterialApp(home: new LoginForm()) )