fix: handle unsupported flutter versions gracefully (#3405) (#3415)

Co-authored-by: Eric Seidel <eric@shorebird.dev>
This commit is contained in:
Aditya Pandey
2025-12-04 21:09:33 +05:30
committed by GitHub
parent f96e926fae
commit 5f6638a0b1
2 changed files with 11 additions and 7 deletions
@@ -263,11 +263,15 @@ class ShorebirdFlutter {
/// Returns the git revision for the provided [version].
/// e.g. 3.16.3 -> b9b23902966504a9778f4c07e3a3487fa84dcb2a
Future<String?> 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].
@@ -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(