Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to split the pubspec.yaml file into several files

Tags:

yaml

flutter

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
like image 614
Isak dl Avatar asked Sep 23 '19 08:09

Isak dl


People also ask

What does the Pubspec Yaml file contain?

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.

Can I include a Yaml file inside another?

No, YAML does not include any kind of "import" or "include" statement. You could create a ! include <filename> handler.


Video Answer


1 Answers

No, it is not possible.

pubspec.yaml does not support imports.

like image 97
Rémi Rousselet Avatar answered Oct 19 '22 17:10

Rémi Rousselet