我已使用在线链接形式的图像。我想使用资产中的图像。有什么办法吗?
child: _boxes(
"https://nepaldrives.com/wp-content/uploads/2019/10/ktmnewservicecenter3.jpg",
27.7147, 85.3355,"KTM Service Center"),
Widget _boxes(String _image, double lat,double long,String restaurantName)
我已经以这种方式使用了该图像
child: Image(
fit: BoxFit.fill,
image: NetworkImage(_image),
),
正如您在评论中提到的,您要使用资产中的图像。因此,请替换您的
Image(
image: NetworkImage(_image),
),
with
Image(
image: AssetImage('assets/images/your_image.png'),
),