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
?
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.
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.
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.
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
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