When I start a debugging session (pressing F5) I receive the following messages:
dart:ui:1: Error: Not found: dart:ui.
Exited (sigterm)
The
Magically if you add:
import 'package:flutter/widgets.dart';
at the top of that file you want to Run or Debug, and delete the existing configuration, it will run as flutter instead of dart.
Why? Idea/Android Studio scans the file that you're asking to Run or Debug for flutter imports and uses that to decide whether the initial run configuration should be a dart or flutter one. If you import any flutter packages, you get a flutter run configuration.
Confusingly, it does this only the first time you Run/Debug that file, and remembers the run configuration. If your run configuration was created as the wrong kind (Dart instead of Flutter), you'll need to go into the "Edit Configurations" menu to delete it, than are to Run/Debug that file again.
Its very confusing behavior, particularly since your imports are insufficient to know whether the file should be run as Flutter or plain old Dart -- your file's import may import another file that imports a flutter library. It may be detected as Dart, when Flutter it the right configuration.
They should have just added "Run Dart", "Run Flutter".