Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 639
Денис Тараненко Avatar asked Jun 30 '21 07:06

Денис Тараненко


People also ask

How do you create a folder in flutter?

Create a new Directory to give access the directory with the specified path: var myDir = Directory('myDir'); Most instance methods of Directory exist in both synchronous and asynchronous variants, for example, create and createSync.

How do I list files in a Directory in flutter?

To list all the files or folders, you have to use flutter_file_manager, path, and path_provider_ex flutter package. Add the following lines in your pubspec. yaml file to add this package in your dependency. Add read / write permissions in your android/app/src/main/AndroidManifest.

How do I create a storage file in flutter?

To create a Directory of App in Internal Storage use this snippet: Directory directory = await getExternalStorageDirectory(); String fileName = "xyz. pdf"; String newPath = ""; print(directory); List<String> paths = directory. path.


1 Answers

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

like image 171
Eugene Kuzmenko Avatar answered Sep 28 '22 09:09

Eugene Kuzmenko