Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dart UI error #1827

Closed
FeimiSzy opened this issue Jul 2, 2019 · 7 comments
Closed

Dart UI error #1827

FeimiSzy opened this issue Jul 2, 2019 · 7 comments

Comments

@FeimiSzy
Copy link

FeimiSzy commented Jul 2, 2019

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;
@DanTup
Copy link
Member

DanTup commented 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).

@DanTup DanTup added the awaiting info Requires more information from the customer to progress label Jul 2, 2019
@FeimiSzy
Copy link
Author

FeimiSzy commented Jul 3, 2019

Thank you Dan.
I am new to flutter,vscode. By your remind I realized that i used Dart SDK. Now the problem is solved!

@DanTup
Copy link
Member

DanTup commented Jul 3, 2019

Great, glad to hear!

@DanTup DanTup closed this as completed Jul 3, 2019
@DanTup DanTup added is question and removed awaiting info Requires more information from the customer to progress labels Jul 3, 2019
@david97wong
Copy link

Thank you Dan.
I am new to flutter,vscode. By your remind I realized that i used Dart SDK. Now the problem is solved!

can you show me the step?
Thanks in advance.

@noordawod
Copy link

noordawod commented Feb 17, 2022

How hard can it be to add a setting to VS Code that enables the dumb developer (us) to set the Dart mode manually ("dart", "flutter"). That would have fixed this and enable cross-developer interoperability easily.

And yes, I'm having the same problem because VS Code cannot determine that the top-level directory contains many Flutter projects, each in their subdirectory. A pitty really since I was considering VS Code over IJIU/AS.

@DanTup
Copy link
Member

DanTup commented Feb 17, 2022

@noordawod I'm sorry you're having trouble, but if your projects are not being detected correctly then the best action is to fix that, not to provide a setting to workaround it. Adding a setting will cause people to use it and not raise issues when the extension is not detecting projects correctly.

If you file a new issue with a description of the issue and your setup, I'd very much like to fix it.

@noordawod
Copy link

Here you go: #3834

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants