mirror of
https://github.com/flutter/samples.git
synced 2025-11-14 11:28:36 +00:00
Flutter 3.29 beta (#2571)
This commit is contained in:
@@ -10,18 +10,18 @@ import 'activity_repository.dart';
|
||||
/// Local implementation of ActivityRepository
|
||||
/// Uses data from assets folder
|
||||
class ActivityRepositoryLocal implements ActivityRepository {
|
||||
ActivityRepositoryLocal({
|
||||
required LocalDataService localDataService,
|
||||
}) : _localDataService = localDataService;
|
||||
ActivityRepositoryLocal({required LocalDataService localDataService})
|
||||
: _localDataService = localDataService;
|
||||
|
||||
final LocalDataService _localDataService;
|
||||
|
||||
@override
|
||||
Future<Result<List<Activity>>> getByDestination(String ref) async {
|
||||
try {
|
||||
final activities = (await _localDataService.getActivities())
|
||||
.where((activity) => activity.destinationRef == ref)
|
||||
.toList();
|
||||
final activities =
|
||||
(await _localDataService.getActivities())
|
||||
.where((activity) => activity.destinationRef == ref)
|
||||
.toList();
|
||||
|
||||
return Result.ok(activities);
|
||||
} on Exception catch (error) {
|
||||
|
||||
@@ -11,9 +11,8 @@ import 'activity_repository.dart';
|
||||
/// Implements basic local caching.
|
||||
/// See: https://docs.flutter.dev/get-started/fwe/local-caching
|
||||
class ActivityRepositoryRemote implements ActivityRepository {
|
||||
ActivityRepositoryRemote({
|
||||
required ApiClient apiClient,
|
||||
}) : _apiClient = apiClient;
|
||||
ActivityRepositoryRemote({required ApiClient apiClient})
|
||||
: _apiClient = apiClient;
|
||||
|
||||
final ApiClient _apiClient;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user