Last updated:
0 purchases
git info plus
git_info_plus #
Get git information from within the Flutter application.
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;
copied to clipboard
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>
copied to clipboard
2. Enable Processes Info.plist File
BuildSettings > Processes Info.plist File
Change to YES
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
copied to clipboard
3-B. Add Input Files.
${TEMP_DIR}/Preprocessed-Info.plist
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.