flutter_gen库的使用
第一步、项目yarml中dev_dependencies 新增一下flutter_gen_runner 和build_runner
dev_dependencies:build_runner: nullflutter_gen_runner: null # flutter packages pub run build_runner build
第二步、新增配置信息 和(dev_dependencies 同级的)
# 图片资源本地化命令行 flutter packages pub run build_runner build
flutter_gen:output: lib/gen/ # Optional (default: lib/gen/)lineLength: 80 # Optional (default: 80)# Optionalintegrations:flutter_svg: trueflare_flutter: truerive: truelottie: trueassets:enabled: true
第三步下载安装 flutter_gen
dart pub global activate flutter_gen
第四步、直接使用命令生成
flutter packages pub run build_runner build