assets_inserter 0.1.3+2 copy "assets_inserter: ^0.1.3+2" to clipboard
assets_inserter: ^0.1.3+2 copied to clipboard

AssetsInserter automates adding asset paths to Flutter code with using templates.

AssetsInserter #

AssetsInserter is a command-line tool for automatically inserting asset paths into Flutter code by using templates.

Installation #

You can install AssetsInserter globally using the following command:

flutter pub global activate assets_inserter

Usage #

To use AssetsInserter, navigate to the root directory of your Flutter project and run the following command:

dart assets_inserter.dart:replace

This command will recursively search for Dart files in the lib directory of your project, find asset path strings matching a specified pattern (e.g., ["assets/images/pic[000:002].png"])?, for dir(e.g., ["assets////"]), and replace them with arrays of image paths. The script supports leading zeros in the range specified within the square brackets.

Example #

From

class MyApp {
  final List<String> images = ["assets/images/pic[00:2].png"];
  final String path = "assets/images/logo.png";
}

To

class MyApp {
  final List<String> images = [
    "assets/images/pic00.png",
    "assets/images/pic01.png",
    "assets/images/pic02.png"
  ];
  final String path = "assets/images/logo.png";
}

From

class MyApp {
  final List<String> images = ["assets///"];
}

To

class MyApp {
  final List<String> images = [
    "assets/1.png",
    "assets/2.png",
    "assets/3.png"
  ];
}
1
likes
140
points
0
downloads

Publisher

unverified uploader

Weekly Downloads

AssetsInserter automates adding asset paths to Flutter code with using templates.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on assets_inserter