1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-10 23:08:59 +00:00

[compass_app] Standardize on Result factories rather than constructors (#2538)

From my review of the recipes PR in
https://github.com/flutter/website/pull/11444#pullrequestreview-2480423811.
This commit is contained in:
Parker Lougheed
2024-12-05 21:38:14 +08:00
committed by GitHub
parent 33701ce1c5
commit c3c93a82f5
11 changed files with 26 additions and 26 deletions

View File

@@ -98,7 +98,7 @@ class BookingCreateUseCase {
case Ok<List<Destination>>():
final destination = result.value
.firstWhere((destination) => destination.ref == destinationRef);
return Ok(destination);
return Result.ok(destination);
case Error<List<Destination>>():
return Result.error(result.error);
}

View File

@@ -37,7 +37,7 @@ class BookingShareUseCase {
try {
await _share(text);
_log.fine('Shared booking');
return Result.ok(null);
return const Result.ok(null);
} on Exception catch (error) {
_log.severe('Failed to share booking', error);
return Result.error(error);