Flutter 应用程序包含代码和 assets(也为资源)。资源是被打包到应用程序安装包中,可以在运行时访问的一种文件。常见的资源类型包括静态数据(例如 JSON 文件),配置文件,图标和图片(JPEG,WebP,GIF,动画 WebP / GIF,PNG,BMP 和 WBMP)。
加载本地图片
新建资源文件夹assets,将图片加入到文件夹中

新建资源文件夹.png
声明分辨率相关的图片assets

官方文档.png
大坑提示:若想Android Studio自动识别分辨率相关图片,必须给定1.0x图片,否则,需指定具体路径,如:assets/public/3.0x/xxx.png。
插件推荐:flutter_add_image,可自动通过3x图片生成1x,2x图片。
在pubspec.yaml新增相关路径
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
assets:
- assets/public/
- assets/public/2.0x/
- assets/public/3.0x/
代码调用
Image.asset('assets/public/xxx.png')