I pasted the demo code from google, it was ok. And several times later, the following appeared: the code has nothing wrong. I put it in Android Studio and the right info appeared in the phone. I reinstalled vs code, started a new project. But the problem is still there. Anyone can help?

The following is the demo code from google flutter website:

 import 'package:flutter/material.dart';

void main() => runApp(new MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'Welcome to Flutter',
      home: new Scaffold(
        appBar: new AppBar(
          title: new Text('Welcome to Flutter'),
        ),
        body: new Center(
          child: new Text("what's wrong?"),
        ),
      ),
    );
  }
}

The following is the wrong info:

PS D:\app\flutter_app\aaa\sss> dart "d:\app\flutter_app\aaa\sss\lib\main.dart"
file:///d:/app/flutter_app/aaa/sss/lib/main.dart:1: Warning: Interpreting this as package URI, 'package:sss/main.dart'.
file:///C:/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:///C:/flutter/packages/flutter/lib/src/material/animated_icons.dart:10:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
       ^
file:///C:/flutter/packages/flutter/lib/src/material/app.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' as ui;
       ^
file:///C:/flutter/packages/flutter/lib/src/material/app_bar_theme.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
       ^
file:///C:/flutter/packages/flutter/lib/src/material/arc.dart:6:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
       ^
file:///C:/flutter/packages/flutter/lib/src/material/bottom_app_bar_theme.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
       ^
file:///C:/flutter/packages/flutter/lib/src/material/card_theme.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
       ^
file:///C:/flutter/packages/flutter/lib/src/material/chip_theme.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
       ^
file:///C:/flutter/packages/flutter/lib/src/material/colors.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' show Color;
       ^
file:///C:/flutter/packages/flutter/lib/src/material/dialog_theme.dart:5:8: Error: Not found: 'dart:ui'import 'dart:ui' show lerpDouble;

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
DanTupcommented, Jul 2, 2019

Errors loading dart:ui are usually caused by using a standard Dart SDK and not a Flutter SDK. Can you post your pubspec.yaml, and also how many levels deep the Flutter project is from the folder you opened in VS Code? (we only look a certain number of levels down the tree for Flutter projects).

0reactions
noordawodcommented, Feb 17, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

dart:ui:1: Error: Not found: dart:ui. flutter/dart: - Stack Overflow
In short, you are running a file as dart file, but you have imported flutter dependencies like widgets/material at the same time. Either...
Read more >
Not found: 'dart:ui' when trying to run a Flutter project #3834
If it's neither of these, please run the Dart: Capture Debugging Logs command from the command palette ( F1 ), try to run...
Read more >
How to solve Not found: 'dart:ui' error while running integration ...
[Solved]-How to solve Not found: 'dart:ui' error while running integration tests on Flutter-Flutter · select Edit Configurations · Press the + button and...
Read more >
How to Handle errors on UI in Flutter - (English) - YouTube
Subscribe : https://goo.gl/X1cN6iTelegram Group: https://t.me/joinchat/Ea589xjrIwAJOQTsOpeNBAGithub: https://github.com/RenatoLucasMota.
Read more >
How to solved 'dart:ui' error when going to run flutter app?
Solution. When you run the app, you will see 2 main. dart entry. Please pick the one with Flutter icon.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found