Skip to content

arononak/git_stamp

Repository files navigation

Git Stamp 🏷 Stamp Every App Build!

Advanced await-less information provider & development tool.

Latest Tag GitHub stars Commits Dev Prod

Pub Package Likes package publisher

ExampleExample EncryptedAPI Documentation

Git Config Details

📑️ About (Changelog)

Why Git Stamp?

When working with Flutter and Git, especially in a team environment, human errors such as forgetting to run git pull can lead to issues during branch merges. Git Stamp helps address these problems by offering:

  • Build Date, SHA & Branch Information - Git Stamp allows you to precisely determine which version of the application was deployed. This is especially useful during debugging or verifying issues, as application versions and build numbers are not always updated correctly.
  • Debugging and Troubleshooting - Knowing the build date and exact code version (SHA) makes it much easier for the development team to identify the problematic code when users report bugs.
  • Avoiding Lost Changes in Teamwork - It allows you to quickly see which commits made it into the final version of the application, helping to prevent missing changes due to overlooked git pull commands.
  • Caching Issues in the Web Version - Even if the latest version is deployed, users may still see an older version due to caching. Git Stamp helps identify whether the deployed version or an outdated one was loaded.
Mechanism 🕯️
graph TD
    CODE((SOURCE CODE))-->SYNC(flutter pub get)
    SYNC-->BUILD(flutter build ...)

    subgraph "App"
        CODE
        PUB
        PUB((PACKAGES))-->CODE
    end

    subgraph "Git Stamp"
        GIT_CLI(GIT CLI)-->GENERATOR
        DART_CLI(DART CLI)-->GENERATOR
        FLUTTER_CLI(FLUTTER CLI)-->GENERATOR
    end

    subgraph "Git Stamp CLI"
        GENERATE
        ADD
    end

    GENERATOR((GENERATOR))-->ADD(~$ dart pub add git_stamp)
    ADD-->|Add package|PUB

    GENERATOR-->GENERATE(~$ dart run git_stamp)
    GENERATE-->|Create ./git_stamp directory with .dart files|CODE
Loading

Inspiration

The main inspiration was Minecraft with information like this:

Version: v1.20.81
Build: 24130126
Branch: r/20_u8
SHA: a9081c5429038dcf3f26269f7351d89f

Git Stamp code:

import 'git_stamp/git_stamp.dart';

Text('Version: ${GitStamp.appVersion}'),
Text('Build: ${GitStamp.appBuild}'),
Text('Branch: ${GitStamp.buildBranch}'),
Text('SHA: ${GitStamp.sha}'),
dependencies:
  git_stamp: ^5.2.0
dependency_overrides:
  meta: ^1.1.5
dart run git_stamp --build-type full
if (kDebugMode) ...[
  GitStamp.listTile(
    context: context,
    monospaceFontFamily: GoogleFonts.spaceMono().fontFamily,
  ),
],

🔥Contributors

💰 Sponsors

Aron Code

📝 License

Note

Copyright © 2024 Aron Onak. All rights reserved.
Licensed under the MIT license.
If you have any feedback, please contact me at arononak@gmail.com