我的Flutter应用程序运行正常,但开始出现多个编译错误。我也已经厌倦了带有样板代码的新项目,但是它也会引发同样的错误。任何帮助都会很棒。我已经厌倦了升级和清理项目,但没有成功。
flutter: The following _CompileTimeError was thrown building AppBar(dirty, state: _AppBarState#61196):
flutter: 'package:flutter/src/material/app_bar.dart': error: line 399 pos 29:
flutter: file:///Users/bradmurray/Developer/flutter/packages/flutter/lib/src/material/app_bar.dart:399:29:
flutter: Error: Too few positional arguments: 1 required, 0 given.
flutter: leading = IconButton(
flutter: ^
flutter: leading = IconButton(
flutter: ^
flutter:
[Screen shot][1]
[1]: https://i.stack.imgur.com/ZUO2Y.png
I am also getting this error form time to time:
Compiler message:
file:///Users/UserName/Developer/flutter/packages/flutter/lib/src/material/icon_button.dart:87:20: Error: Duplicated parameter name 'icon'.
@required this.icon,
^^^^
file:///Users/UserName/Developer/flutter/packages/flutter/lib/src/material/icon_button.dart:82:25: Context: Other parameter named 'icon'.
const IconButton(Icon icon, {
^^^^
file:///Users/UserName/Developer/flutter/packages/flutter/lib/src/widgets/basic.dart:3726:23: Error: Duplicated parameter name 'text'.
Row(Text text, Text text, {
^^^^
file:///Users/UserName/Developer/flutter/packages/flutter/lib/src/widgets/basic.dart:3726:12: Context: Other parameter named 'text'.
.......
答案 0 :(得分:1)
IconButton
要求您传递一个Icon
小部件和一个onPressed
回叫。