flutterdartcode-generationbuild-runner

Is there a way to put the generated files in a separate folder in flutter?


In my app, I use freezed with json_serializable. In the folder, where I put all my data models a lot of generated files, like model.g.dart, model.freeezed.dart. Is there any possibility to move all generated files like that to a separate folder in the project, like generated?


Solution

  • Accordint to the build_runner documentation

    flutter pub run build_runner build --output <dirname>
    

    or

    flutter pub run build_runner build --output models:<directory name>
    

    to output only the models directory