这是我在home.dart中添加此代码时遇到的错误

WallpaperModel wallpaperModel = WallpaperModel();
wallpaperModel = WallpaperModel.fromMap(element);
wallpapers.add(wallpaperModel);

也/widget/widget.dart
Widget wallpapersList({List<WallpaperModel> wallpapers, context}) { return Container( padding: EdgeInsets.symmetric(horizontal: 15.0), child: GridView.count( shrinkWrap: true, physics: ClampingScrollPhysics(), crossAxisCount: 2, childAspectRatio: 1.0, mainAxisSpacing: 5.0, crossAxisSpacing: 5.0, children: wallpapers.map((wallpaper) { return GridTile( child: Container( child: Image.network(wallpaper.src.portrait), ), ); }).toList(), ), ); }

api - 断言失败:url!= null不正确-LMLPHP

这是我执行code时遇到的错误,我也尝试使用flutter clean然后运行flutter run -v

最佳答案

看到您的代码后,请更改

return SrcModel(
  orignal: jsonData["orignal"],
  small: jsonData["small"],
  portrait: jsonData["protrait"],
);


return SrcModel(
  orignal: jsonData["original"],
  small: jsonData["small"],
  portrait: jsonData["portrait"],
);

现在我看到你的照片,我喜欢你的设计

关于api - 断言失败:url!= null不正确,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/62134248/

10-16 05:56