mirror of
https://github.com/flutter/samples.git
synced 2025-11-12 15:58:32 +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:
@@ -16,12 +16,12 @@ class AuthRepositoryDev extends AuthRepository {
|
||||
required String email,
|
||||
required String password,
|
||||
}) async {
|
||||
return Result.ok(null);
|
||||
return const Result.ok(null);
|
||||
}
|
||||
|
||||
/// Logout is always successful in dev scenarios
|
||||
@override
|
||||
Future<Result<void>> logout() async {
|
||||
return Result.ok(null);
|
||||
return const Result.ok(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ class BookingRepositoryLocal implements BookingRepository {
|
||||
// Bookings created come without id, we need to assign one
|
||||
final bookingWithId = booking.copyWith(id: _sequentialId++);
|
||||
_bookings.add(bookingWithId);
|
||||
return Result.ok(null);
|
||||
return const Result.ok(null);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -92,6 +92,6 @@ class BookingRepositoryLocal implements BookingRepository {
|
||||
@override
|
||||
Future<Result<void>> delete(int id) async {
|
||||
_bookings.removeWhere((booking) => booking.id == id);
|
||||
return Result.ok(null);
|
||||
return const Result.ok(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,6 @@ class ItineraryConfigRepositoryMemory implements ItineraryConfigRepository {
|
||||
ItineraryConfig itineraryConfig,
|
||||
) async {
|
||||
_itineraryConfig = itineraryConfig;
|
||||
return Result.ok(true);
|
||||
return const Result.ok(true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user