diff --git a/lib/src/models/flutter_version_model.dart b/lib/src/models/flutter_version_model.dart index e9353e01..7034449c 100644 --- a/lib/src/models/flutter_version_model.dart +++ b/lib/src/models/flutter_version_model.dart @@ -122,4 +122,7 @@ class FlutterVersion with FlutterVersionMappable { return compareSemver(versionWeight, otherVersion); } + + @override + String toString() => name; } diff --git a/lib/src/workflows/ensure_cache.workflow.dart b/lib/src/workflows/ensure_cache.workflow.dart index a1d3494a..a9ecb69e 100644 --- a/lib/src/workflows/ensure_cache.workflow.dart +++ b/lib/src/workflows/ensure_cache.workflow.dart @@ -21,6 +21,7 @@ Future ensureCacheWorkflow( bool force = false, }) async { _validateContext(); + _validateGit(); // Get valid flutter version final validVersion = await validateFlutterVersion(version, force: force); try { @@ -238,3 +239,10 @@ void _validateContext() { ); } } + +void _validateGit() { + final isGitInstalled = Process.runSync('git', ['--version']).exitCode == 0; + if (!isGitInstalled) { + throw AppException('Git is not installed'); + } +}