So I’m new to Flutter and I’m facing a issue running the code in VS code. The problem does not occur in Android Studio. I’ve made a new project (the default counter app) for android application on windows and whenever I run it on VS code, I get following errors:
[Running] dart "d:untitledlibmain.dart"
/C:/flutter/packages/flutter/lib/src/material/animated_icons.dart:9:8: Error: Dart library 'dart:ui' is not available on this platform.
import 'dart:ui' as ui show Canvas, Paint, Path, lerpDouble;
^
Context: The unavailable library 'dart:ui' is imported through these packages:
package:untitled => package:flutter => dart:ui
...
Reference Image
The code runs fine in when I use Start debugging or use “Flutter Run”, it also runs fine on android studio. I’ve tried to reinstall VS code but nothing helped. I think the IDE is detecting the project to be a Dart project instead of flutter. I only have code runner installed along with flutter and dart extensions. Does anyone know what could be the issue? Thanks
ht_ghauri is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.