Last updated:
0 purchases
assets inserter
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
copied to clipboard
Usage #
To use AssetsInserter, navigate to the root directory of your Flutter project and run the following command:
dart assets_inserter.dart:replace
copied to clipboard
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";
}
copied to clipboard
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";
}
copied to clipboard
From
class MyApp {
final List<String> images = ["assets///"];
}
copied to clipboard
To
class MyApp {
final List<String> images = [
"assets/1.png",
"assets/2.png",
"assets/3.png"
];
}
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.