dart - 需要 1 个必需参数,但找到 0 个
问题描述
我是使用颤振的新手,并且由于上述错误而被卡住了一个多星期。我在这个论坛上搜索了可能的解决方案,但没有找到。这是下面的代码,请协助更正/建议。提前致谢:
==================================================== ================
class AfterSplash extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new Scaffold( <=1 required argument(s) expected, but 0 found. on the open bracket sign
appBar: new AppBar(
title: new Text('Test'),
),
backgroundColor: Colors.black38,
body:
new ImageCarousel(
<ImageProvider>[
new NetworkImage(
'http://wallpaper-gallery.net/images/images/images-2.jpg'),
new NetworkImage(
'http://wallpaper-gallery.net/images/images/images-10.jpg'),
new NetworkImage(
'http://wallpaper-gallery.net/images/images/images-4.jpg'),
],
interval: new Duration(seconds: 5),
),
bottomNavigationBar: new BottomNavigationBar(
currentIndex: 0,
items: [
new BottomNavigationBarItem(
icon: const Icon(Icons.local_movies),
title: new Text('VIDEOS'),
),
new BottomNavigationBarItem(
icon: const Icon(Icons.camera_alt),
title: new Text('PICTURES'),
),
new BottomNavigationBarItem(
icon: const Icon(Icons.contacts),
title: new Text('BOOKING'),
),
]
)
);
}
}
解决方案
你在用 Dart2 吗?
假设这是您用于 ImageCarousel 的包,则此包不适用于 Dart2。
我在没有 ImageCarousel 小部件的情况下在 Dart2 中复制了您的代码,它运行良好。
推荐阅读
- python - OpenCV - 许可证位置检测中的误报太多
- php - Switch Case Vs Array Key Lookup,考虑到空间复杂度,后者更快
- css - Angular 5+ animate flex 在 Firefox 中不起作用
- excel - python win32错误,Microsoft Excel',
- javascript - 无法使用 Google Analytics 中的 cookie 过滤掉内部流量
- c# - 实体框架相当于多个连接?
- javascript - 随机数猜谜游戏的问题。不显示答案是否正确
- google-apps-script - 如何通过 Apps 脚本清除 Google 幻灯片中的格式?
- react-native - 当我尝试将数据呈现到表中时,它会抛出 null is not object in React Native
- sparql - GraphDB 查询静默失败 (OutOfMemoryError)