Below error occurs when I try to run my first flutter app.
file:///Volumes/Data/FlutterSDk/flutter/packages/flutter/lib/src/cupertino/action_sheet.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' show ImageFilter;
^
file:///Volumes/Data/FlutterSDk/flutter/packages/flutter/lib/src/cupertino/bottom_tab_bar.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' show ImageFilter;
^
file:///Volumes/Data/FlutterSDk/flutter/packages/flutter/lib/src/cupertino/colors.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' show Color;
^
file:///Volumes/Data/FlutterSDk/flutter/packages/flutter/lib/src/cupertino/dialog.dart:6:8: Error: Not found: 'dart:ui'
import 'dart:ui' show ImageFilter;
^
file:///Volumes/Data/FlutterSDk/flutter/packages/flutter/lib/src/cupertino/nav_bar.dart:6:8: Error: Not found: 'dart:ui'
import 'dart:ui' show ImageFilter;
^
file:///Volumes/Data/FlutterSDk/flutter/packages/flutter/lib/src/cupertino/slider.dart:6:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
^
file:///Volumes/Data/FlutterSDk/flutter/packages/flutter/lib/src/cupertino/switch.dart:6:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
^
file:///Volumes/Data/FlutterSDk/flutter/packages/flutter/lib/src/material/animated_icons.dart:9:8: Error: Not found: 'dart:ui'
import 'dart:ui' as ui show Paint, Path, Canvas;
^ file:///Volumes/Data/FlutterSDk/flutter/packages/flutter/lib/src/material/animated_icons.dart:10:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
^ file:///Volumes/Data/FlutterSDk/flutter/packages/flutter/lib/src/material/arc.dart:6:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
^
Process finished with exit code 254
I have tried many ways to solve this issue but still, this issue is coming.
You are getting those errors because your IDE is executing main.dart
as a simple dart application and not as a Flutter application.
As answered by salihguler, if you are using Android SDK then choose the main.dart
file with Flutter Icon beside it and not the one with Dart Icon and the project should work just fine.
If you are using VS Code then instead of hitting Run (Ctrl+Alt+N) go to Debug -> Start Debugging option or simply press F5 and errors will be gone.
When you run the app, you will see 2 main.dart
entry. Please pick the one with Flutter icon. I get it from here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With