Features

帮助你在flutter开发中快速生成图片资源相关代码
Help you quickly generate code related to image resources in Flutter development

Getting started

在pubspec.yaml文件中添加如下依赖(Add this to your package's pubspec.yaml file:)

dev_dependencies:
  flutter_assets: ^0.0.6

设置图片路径 (Set image path)

picture

Usage

步骤1:在test目录下创建一个test.dart文件,输入如下代码:

Step1:in the test directory, create a test.dart file, and enter the following code:

void main() async {
  test('RefreshAssets', () async {
    await FlutterAssets.refresh();
  });

  /// Check Unused Assets,Only applicable to resources generated by "FlutterAssets.refresh()"
  test('CheckUnusedAssets', () async {
    await FlutterAssets.checkUnused();
  });
  
}

步骤2:点击test.dart文件中的运行按钮,生成图片资源代码

Step2:Click the run button in the test.dart file to generate the image resource code picture

运行成功(Run Successfully)

picture

自动生成文件(Automatically generate files)

picture

第一次运行成功后,在AndroidStudio顶部工具栏中可以看到RefreshAssets,以后可以直接选择该选项,一键运行

After the first successful run, you can see RefreshAssets in the top toolbar of AndroidStudio, and you can directly select this option for one-click operation in the future picture

运行成功(Run Successfully)

picture

Libraries

flutter_assets