From 5f6638a0b1c2240e008d8a5a559affa275a3e05e Mon Sep 17 00:00:00 2001 From: Aditya Pandey <116456309+EclipseAditya@users.noreply.github.com> Date: Thu, 4 Dec 2025 21:09:33 +0530 Subject: [PATCH] fix: handle unsupported flutter versions gracefully (#3405) (#3415) Co-authored-by: Eric Seidel --- .../shorebird_cli/lib/src/shorebird_flutter.dart | 14 +++++++++----- .../test/src/shorebird_flutter_test.dart | 4 ++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/packages/shorebird_cli/lib/src/shorebird_flutter.dart b/packages/shorebird_cli/lib/src/shorebird_flutter.dart index d05abaa3..89d72f27 100644 --- a/packages/shorebird_cli/lib/src/shorebird_flutter.dart +++ b/packages/shorebird_cli/lib/src/shorebird_flutter.dart @@ -263,11 +263,15 @@ class ShorebirdFlutter { /// Returns the git revision for the provided [version]. /// e.g. 3.16.3 -> b9b23902966504a9778f4c07e3a3487fa84dcb2a Future getRevisionForVersion(String version) async { - final result = await git.revParse( - revision: 'refs/remotes/origin/flutter_release/$version', - directory: _workingDirectory(), - ); - return LineSplitter.split(result).toList().firstOrNull; + try { + final result = await git.revParse( + revision: 'refs/remotes/origin/flutter_release/$version', + directory: _workingDirectory(), + ); + return LineSplitter.split(result).toList().firstOrNull; + } on ProcessException { + return null; + } } /// Get the list of Flutter versions for the given [revision]. diff --git a/packages/shorebird_cli/test/src/shorebird_flutter_test.dart b/packages/shorebird_cli/test/src/shorebird_flutter_test.dart index 36e0e877..a2b01d46 100644 --- a/packages/shorebird_cli/test/src/shorebird_flutter_test.dart +++ b/packages/shorebird_cli/test/src/shorebird_flutter_test.dart @@ -465,12 +465,12 @@ Tools • Dart 3.0.6 • DevTools 2.23.1'''); ).thenThrow(exception); }); - test('throws exception', () async { + test('returns null', () async { await expectLater( runWithOverrides( () => shorebirdFlutter.getRevisionForVersion(version), ), - throwsA(exception), + completion(isNull), ); verify( () => git.revParse(