We have a git repository in which a sub folder holds a flutter app:
project/.git
project/app/*
project/backend/*
Now I would like to bundle some files of the .git
folder in the app:
# pubspec.yaml
assets:
- ../.git/HEAD
- ../.git/ORIG_HEAD
- ../.git/refs/heads/
This works when running on an emulator:
// somewhere in the app:
final _head = await rootBundle.loadString('../.git/HEAD');
But when building the app in release mode, the files are not bundled what perfectly makes sense - but I wonder how we can copy/bundle the files.
My naive approach would be to run a script that copies the files to the app folder, but that is brittle as we need to remember to run the script before each build. What would be a more consistent approach?