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 41ce2286..65e47866 100644 --- a/lib/src/workflows/ensure_cache.workflow.dart +++ b/lib/src/workflows/ensure_cache.workflow.dart @@ -22,6 +22,7 @@ Future ensureCacheWorkflow( bool force = false, }) async { _validateContext(); + _validateGit(); // Get valid flutter version final validVersion = await validateFlutterVersion(version, force: force); try { @@ -261,3 +262,10 @@ void _validateContext() { ); } } + +void _validateGit() { + final isGitInstalled = Process.runSync('git', ['--version']).exitCode == 0; + if (!isGitInstalled) { + throw AppException('Git is not installed'); + } +}