Flutter 以字符串形式存储图像

Flutter 以字符串形式存储图像,flutter,flutter-layout,Flutter,Flutter Layout,我在网上使用了链接形式的图像。 我想使用资产中的图像。 有办法吗 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,

我在网上使用了链接形式的图像。 我想使用资产中的图像。 有办法吗

 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),
),


使用
image:AssetImage('your_asset_image)
你的意思是,你想从链接下载图像,保存到assets,然后显示它吗?不,我想显示assets中的图像。记住也要在你的pubspec.yaml中包含资产
Image(
  image: AssetImage('assets/images/your_image.png'),
),