Get git information from within the Flutter application

Overview

git_info_plus

pub package

Get git information from within the Flutter application.

screenshot-android screenshot-ios

Usage

Dart

final String branchName = await GitInfo.branchName;
final DateTime lastCommitDate = await GitInfo.lastCommitDate;
final String lastCommitHash = await GitInfo.lastCommitHash;
final String lastCommitHashShort = await GitInfo.lastCommitHashShort;
final String lastCommitMessage = await GitInfo.lastCommitMessage;

Setup

Android

You do not need to set this up.

Optional

  • Read environment valus if git command is null

iOS

In order to use this library on IOS, you have to do some settings.

1. Add values in your info.plist

Key Type Value
GitBranchName String undefined
GitCommitDate String undefined
GitCommitHash String undefined
GitCommitHashShort String undefined
GitCommitMessage String undefined

You can also copy and paste these lines.

<key>GitBranchName</key>
<string>undefined</string>
<key>GitCommitDate</key>
<string>undefined</string>
<key>GitCommitHash</key>
<string>undefined</string>
<key>GitCommitHashShort</key>
<string>undefined</string>
<key>GitCommitMessage</key>
<string>undefined</string>

setup-ios-1

2. Enable Processes Info.plist File

BuildSettings > Processes Info.plist File
Change to YES

setup-ios-2

3-A. Add Run Script

BuildPhase >

Add new Run Script and paste these lines.

plistBuddy="/usr/libexec/PlistBuddy"
infoPlistFile="${TEMP_DIR}/Preprocessed-Info.plist"

branchName=$(git branch --show-current)
commitDate=$(git --no-pager log -1 --format="%ai")
commitHash=$(git rev-parse HEAD)
commitHashShort=$(git rev-parse --short HEAD)
commitMessage=$(git log -1 --pretty=%s)

$plistBuddy -c "Set :GitBranchName $branchName" $infoPlistFile
$plistBuddy -c "Set :GitCommitDate $commitDate" $infoPlistFile
$plistBuddy -c "Set :GitCommitHash $commitHash" $infoPlistFile
$plistBuddy -c "Set :GitCommitHashShort $commitHashShort" $infoPlistFile
$plistBuddy -c "Set :GitCommitMessage $commitMessage" $infoPlistFile

setup-ios-3

3-B. Add Input Files.

${TEMP_DIR}/Preprocessed-Info.plist

You might also like...

Generate secure passwords, check for exposed passwords, get visual feedback for password strength or get form validation with a minimum password strength required.

Generate secure passwords, check for exposed passwords, get visual feedback for password strength or get form validation with a minimum password strength required.

password_strength_checker Generate secure passwords, check for exposed passwords, get visual feedback for password strength or get form validation wit

Aug 8, 2023

Let's create a selectable Flutter Navigation Drawer with routing that highlights the current item within the Flutter Sidebar Menu.

Let's create a selectable Flutter Navigation Drawer with routing that highlights the current item within the Flutter Sidebar Menu.

Flutter Tutorial - Sidebar Menu & Selectable Navigation Drawer Let's create a selectable Flutter Navigation Drawer with routing that highlights the cu

Dec 26, 2022

Flutter plugin to manage home screen widget within flutter app.

Flutter App Widget App Widget / Home Screen widget plugin for flutter app Usage Please see app_widget subdirectory for the usage documentation. Plafor

Dec 16, 2022

A flutter package that helps you create an on-boarding screen for your project within minutes just by providing a few parameters.

A flutter package that helps you create an on-boarding screen for your project within minutes just by providing a few parameters.

A flutter package that helps you create an on-boarding screen for your project within minutes just by providing a few parameters.

Sep 27, 2022

Input fields for Flutter standalone or within a form

Flutter Input Widgets - Standalone or within a Form → flutter_input This package provides input widgets (fields) to manipulate data. The data to manip

Mar 14, 2021

This is template toolkit fasten your project setup within a minute. The toolkit is based on MVC+S structure.

This is template toolkit fasten your project setup within a minute. The toolkit is based on MVC+S structure.

BWeird Flutter Toolkit! Hi! From a Weirder Flutter has been great on mobile development and I took this opportunity to make it even greater with templ

Aug 22, 2021

I just designed this within 30 min after watching a video by tech school on YouTube.

I just designed this within 30 min after watching a video by tech school on YouTube.

nft_app A new Flutter application. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if t

Dec 25, 2021

Flutter's application that provides information about Covid-19 in Indonesia

Flutter's application that provides information about Covid-19 in Indonesia

Info Covid-19 Flutter's application that provides information about Covid-19 in Indonesia Report Bug · Request Feature Table of Contents About the Pro

Dec 23, 2021

A Flutter application organizing access to information on University of Toronto Food Options.

A Flutter application organizing access to information on University of Toronto Food Options.

UofT Foods Description A Flutter Mobile App designed to aid UofT Students and Staff easily find food options across all campuses. Features Campus Sele

Jan 8, 2021
Releases(0.0.4)
Owner
Akira Aratani
Android, Kotlin, Flutter, Go https://twitter.com/_a_akira https://aakira.studio
Akira Aratani
Create a Flutter User Profile Page UI where you can access and edit your user's information within your Flutter app.

Flutter Tutorial - User Profile Page UI #2 Create a Flutter User Profile Page UI where you can access and edit your user's information within your Flu

Johannes Milke 45 Dec 15, 2022
The prime objective of this app is to store the real time information of the user using firebase cloud firestore and also can delete, remove and update the customer information

crud_firestore A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started i

Muhammad Zakariya 0 Mar 15, 2022
changelog.dart provides a library and a command-line application to manage in the correct way the git metadata to build the changelog between two release

changelog.dart ?? changelog.dart: a collection of tools to manages in a fashion way a repository as maintainer. ?? Project Homepage Table of Content I

Vincenzo Palazzo 7 Dec 18, 2022
Flutter screen adaptation, font adaptation, get screen information

flutter_screenutil A flutter plugin for adapting screen and font size.Let your UI display a reasonable layout on different screen sizes! Note: This pl

OpenFlutter 3.4k Jan 6, 2023
Access app version and git informations from auto-generated and configurable widgets

This is a proof of concept and WIP Feedback and ideas welcome !! Access your pubspec and git commit informations like versions and commit status from

Robert Felker 15 Jul 7, 2021
Contribute in building the Ultimate GitBook of Developers by creating your git-card.json

Contribute in building the Ultimate GitBook of Developers by creating your git-card.json gitcards The Attractive and Interactive Variant of your GitHu

omega ui 1 Apr 8, 2022
Git+ is your ultimate GitLab mobile app that lets you interact with your projects like as if you were using desktop.

Git+ for GitLab Git+ is your ultimate GitLab mobile app that lets you interact with your projects like as if you were using desktop. Git+ lets you see

Marek Gvora 38 Jan 7, 2023
A simple Git LFS server implementation in Dart

A simple Git LFS server implementation in Dart Overview Git LFS client (git-lfs or git lfs command) requires a dedicated LFS-content server (not the G

Hoàng Văn Khoa 4 Oct 31, 2022
A simple way to share Instagram stories as an embedded feature within the Flutter application

Loopi Share A simple way to share Instagram stories as an embedded feature within the Flutter application. Introduction Words on both platforms Androi

Loopi 5 Sep 24, 2022
Let's explore space together with SpaceApp? Within the SpaceApp application

Let's explore space together with SpaceApp? Within the SpaceApp application, it will give you brief information about the space vehicles renewed every day, the stars discovered. I am happy to present the SpaceApp interface to you.

Yusuf S. Kaygusuz 5 Dec 16, 2022