【发布时间】:2020-09-29 17:53:47
【问题描述】:
我启动了 Android Studio 并安装了它,并由 Flutter 医生检查了 cmd,它显示一切正常。但是当我运行 hello world 程序时,它显示了许多错误,任何人都可以帮助我。下面我粘贴了代码
错误:
The method 'MaterialApp' isn't defined for the type 'MyApp'. (undefined_method at [helloword] lib\MyApp.dart:9)
error: The method 'ThemeData' isn't defined for the type 'MyApp'. (undefined_method at [helloword] lib\MyApp.dart:12)
error: Undefined name 'Colors'. (undefined_identifier at [helloword] lib\MyApp.dart:13)
error: Undefined name 'Colors'. (undefined_identifier at [helloword] lib\MyApp.dart:14)
error: The method 'Scaffold' isn't defined for the type 'MyApp'. (undefined_method at [helloword] lib\MyApp.dart:16)
error: The method 'AppBar' isn't defined for the type 'MyApp'. (undefined_method at [helloword] lib\MyApp.dart:17)
error: Undefined name 'Colors'. (undefined_identifier at [helloword] lib\MyApp.dart:19)
error: Named parameters must be enclosed in curly braces ('{' and '}'). (named_parameter_outside_group at [helloword] lib\main.dart:4)
error: A function body must be provided. (missing_function_body at [helloword] lib\main.dart:4)
error: Default values aren't allowed in function typed parameters. (default_value_in_function_typed_parameter at [helloword] lib\main.dart:4)
error: A function body must be provided. (missing_function_body at [helloword] lib\main.dart:4)
error: The function 'MyApp' isn't defined. (undefined_function at [helloword] test\widget_test.dart:16)
info: Name non-constant identifiers using lowerCamelCase. (non_constant_identifier_names at [helloword] lib\main.dart:4)
info: Unused import: 'package:helloword/main.dart'. (unused_import at [helloword] test\widget_test.dart:11)
【问题讨论】:
-
请在您的问题中填写错误。
-
1.没有为“MyApp”类型定义“materialsapp”方法。 2.没有为类型'MyAp'定义方法'themedata' 3.没有定义函数MyApp。 4.MyApp函数没有定义。像这样的错误很多
-
把你的主页鳕鱼!
-
怎么样? ????其实今天我就在这里注册了??????
-
对此一无所知