git
2.5.0, released 2 weeks ago by kevmoo.com
Git command line wrapper for inspecting and manipulating local Git repositories.
What it does
Exposes a Git directory abstraction in Dart that makes it easy to inspect and manipulate a local Git repository. It provides functions to check commit counts, worktrees, branches, and execute git commands programmatically.
AI-written summary of version 2.5.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to build a Dart or Flutter tool that interacts with local Git repositories.
- You want to programmatically inspect commit history, branches, or check if a working tree is clean.
Skip it when
- You need a full Dart implementation of the Git protocol without depending on the system git executable.
- You are running on a platform that does not have the git command-line tool installed.
Strengths
- Provides a clean Dart API over git commands
- Supports features like worktrees, branch tracking, and fetching
- Cross-platform support across Android, iOS, Windows, macOS, and Linux
Weaknesses
- Requires the system git executable to be present on the host device
- Limited to local repository operations
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 2
Requires the git command-line tool installed and available on the system PATH.
import 'package:git/git.dart';
import 'package:path/path.dart' as p;
Future<void> main() async {
if (await GitDir.isGitDir(p.current)) {
final gitDir = await GitDir.fromExisting(p.current);
final commitCount = await gitDir.commitCount();
print('Git commit count: $commitCount');
}
}Alternatives
Packages that do the same job and could replace git.
- cli_util
Utilities to help build Dart command-line apps, find the SDK, and display progress.
88Compare - cli_tools
Utilities for building command‑line interfaces, including argument parsing, analytics, and progress reporting.
83Compare - icons_launcher
A command-line tool that simplifies updating your Flutter app launcher icon.
71Compare - puby
Run Dart and Flutter commands across multiple projects in the current directory.
68Compare
Works with
Packages commonly used together with git: ones it builds on, ones built on it, and its own family.
- string_scannergit depends on itA class for parsing strings using a sequence of patterns.
- fvmBuilt on gitCLI to manage Flutter SDK versions per project
- peanutBuilt on gitUpdate your GitHub gh-pages branch with compiled Dart web app output.
- flutter_plugin_toolsBuilt on gitCLI tool for managing, testing, and releasing packages across Flutter team repositories