feat(wip): Update entities and adopt a proper repository workflow for trip "obtention"
This commit is contained in:
@@ -1,6 +1,16 @@
|
||||
// import 'package:anyway/data/repositories/trip_repository.dart';
|
||||
// import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:anyway/domain/entities/preferences.dart';
|
||||
import 'package:anyway/domain/entities/trip.dart';
|
||||
import 'package:anyway/presentation/providers/landmark_providers.dart';
|
||||
|
||||
// final weatherRepositoryProvider = Provider<TripRepository>((ref) {
|
||||
// return TripRepositoryImpl(???);
|
||||
// });
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:anyway/presentation/providers/core_providers.dart';
|
||||
|
||||
// Provides a function that creates a trip given preferences.
|
||||
final createTripProvider = Provider<Future<Trip> Function(Preferences)>((ref) {
|
||||
return (Preferences prefs) async {
|
||||
final repo = ref.read(tripRepositoryProvider);
|
||||
final landmarks = await repo.searchLandmarks(prefs);
|
||||
ref.read(intermediateLandmarksProvider.notifier).setLandmarks(landmarks);
|
||||
return repo.getTrip(preferences: prefs, landmarks: landmarks);
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user