As the title describes, I wonder if it is possible to split the pubspec.yaml file in Flutter into several files. The use case I'm thinking about is generating the imported assets declarations with an import script. But it seems like a bad idea to mix code generation and manual edits in the same file.
So I would like to generate a separate assets import file and import that into the pubspec.yaml file.
Is that possible and if so how?
Change this:
flutter:
assets:
- images/a_dot_burr.jpeg
- images/a_dot_ham.jpeg
fonts:
- family: SomeFont
fonts:
-assets: fonts/SomeFont.tff
into something like
flutter:
#import imageAssets.yaml
#import fontsAssets.yaml
yaml file, often referred to as the pubspec. A basic pubspec is generated when you create a new Flutter project. It's located at the top of the project tree and contains metadata about the project that the Dart and Flutter tooling needs to know.
No, YAML does not include any kind of "import" or "include" statement. You could create a ! include <filename> handler.
No, it is not possible.
pubspec.yaml
does not support imports.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With