GitBaker
An easy and simple-to-integrate info baker for Git repositories into your Flutter or Dart project.
Did you ever wanted to show the latest commit number or the last commit message in your Flutter app, as a version number for example? GitBaker is here to help you with that. It bakes the information from your Git repository directly into your Flutter or Dart project.
An example for a generated file can be found in the example folder.
Usage
Firstly, add the GitBaker package to your project by running the following command:
dart pub add dev:gitbaker
You can then simply run the following command to bake the information from your Git repository into your project:
dart run gitbaker
GitBaker will then determine the current Git repository to use and bake the information. This should work in most cases, but in some cases might fail. If this happens, make sure the folder you're running the command in is either root of your Git repository or a subdirectory of it.
Global Usage
If you use GitBaker frequently, or you don't want to add it as a dev dependency in every project, you can install it globally:
dart pub global activate gitbaker
You can then run it from anywhere in your terminal:
gitbaker
Configuration
Either command will create a new file called gitbaker.g.dart
in the lib/generated
directory of your project. You can change this by defining an output directory in your project's pubspec.yaml
file:
...
gitbaker:
# Default is lib/generated
output: lib/src/generated
...