我有一个错误的进口包在颤振



提示:

(很抱歉犯了错误。英语不是我的母语)

(我是新手)

我的颤振项目有很多错误。我想那是因为包裹。当我写:import 'package:flutter/material.dart';时,android studio在它下面画了一条红线,表示错误,当我在导入包上按住鼠标指针时,它说:Target of URI doesn't exist: 'package:flutter/material.dart',我想这就是所有错误的原因。我该怎么修?

我的错误:

error: Target of URI doesn't exist: 'package:flutter/material.dart'. (uri_does_not_exist at [untitled6] binmain.dart:1)
error: The function 'runApp' isn't defined. (undefined_function at [untitled6] binmain.dart:3)
error: Classes can only extend other classes. (extends_non_class at [untitled6] binmain.dart:5)
error: Undefined class 'Widget'. (undefined_class at [untitled6] binmain.dart:8)
error: Undefined class 'BuildContext'. (undefined_class at [untitled6] binmain.dart:8)
error: The method 'MaterialApp' isn't defined for the type 'MyApp'. (undefined_method at [untitled6] binmain.dart:9)
error: Classes can only extend other classes. (extends_non_class at [untitled6] binmain.dart:16)
error: Undefined class 'Widget'. (undefined_class at [untitled6] binmain.dart:19)
error: Undefined class 'BuildContext'. (undefined_class at [untitled6] binmain.dart:19)
error: The method 'Material' isn't defined for the type 'MyScaffold'. (undefined_method at [untitled6] binmain.dart:20)
error: The method 'Column' isn't defined for the type 'MyScaffold'. (undefined_method at [untitled6] binmain.dart:21)
error: The name 'Widget' isn't a type so it can't be used as a type argument. (non_type_as_type_argument at [untitled6] binmain.dart:22)
error: The name 'Row' isn't a class. (creation_with_non_type at [untitled6]     binmain.dart:23)
error: The name 'IconButton' isn't a class. (creation_with_non_type at [untitled6] binmain.dart:24)
error: The method 'Icon' isn't defined for the type 'MyScaffold'. (undefined_method at [untitled6] binmain.dart:25)
error: Undefined name 'Icons'. (undefined_identifier at [untitled6] binmain.dart:25)
error: The name 'Text' isn't a class. (creation_with_non_type at [untitled6] binmain.dart:29)
error: The name 'IconButton' isn't a class. (creation_with_non_type at [untitled6] binmain.dart:30)
error: The method 'Icon' isn't defined for the type 'MyScaffold'. (undefined_method at [untitled6] binmain.dart:32)
error: Undefined name 'Icons'. (undefined_identifier at [untitled6] binmain.dart:32)
error: Expected to find ')'. (expected_token at [untitled6] binmain.dart:37)
error: Expected to find ']'. (expected_token at [untitled6] binmain.dart:38)
error: Expected to find ')'. (expected_token at [untitled6] binmain.dart:38)
error: Expected to find ')'. (expected_token at [untitled6] binmain.dart:39)
info: The method doesn't override an inherited method. (override_on_non_overriding_member at [untitled6] binmain.dart:8)
info: Unnecessary new keyword. (unnecessary_new at [untitled6] binmain.dart:11)
info: The method doesn't override an inherited method. (override_on_non_overriding_member at [untitled6] binmain.dart:19)
info: Unnecessary new keyword. (unnecessary_new at [untitled6] binmain.dart:23)
info: Unnecessary new keyword. (unnecessary_new at [untitled6] binmain.dart:24)
info: Unnecessary new keyword. (unnecessary_new at [untitled6] binmain.dart:29)
info: Unnecessary new keyword. (unnecessary_new at [untitled6] binmain.dart:30)

你能帮帮我吗?我的工作推迟了几天😭

Flutter项目使用的引用中可能出现了问题。您可以运行flutter cleanflutter pub cache repair来帮助重建项目中使用的引用,然后运行flutter pub get来下载配置的插件。

我遇到了同样的问题,我删除了Flutter并重新安装了它。问题已经解决了。

尝试以下步骤:

> flutter clean
> flutter pub get
> flutter pub upgrade

相关内容

  • 没有找到相关文章

最新更新