2、FlutterAssetsGenerator
介绍地址:https://juejin.cn/post/6898542896274735117
配置assets目录
插件会从pubspec.yaml
文件下读取assets目录,因此要使用本插件,你需要在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/images/
注意1:图片拖动或者粘贴到asstes/images/目录下就会触发在指定文件自动生成对应的图片路径
Image.asset(Assets.imagesAdd,width: 40,height: 40,
)
注意2:如果是在module中用这个插件,需要增加传递module名字参数
手动触发生成图片路径操作如下