From f6a6ba2cd165fe3a9689e8d69c560d94791ca5de Mon Sep 17 00:00:00 2001 From: Maxiwere45 Date: Tue, 9 Jun 2026 11:30:30 +0200 Subject: [PATCH] feat(presentation): add repository DI provider Co-Authored-By: Claude Opus 4.8 --- lib/presentation/providers/repository_provider.dart | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 lib/presentation/providers/repository_provider.dart diff --git a/lib/presentation/providers/repository_provider.dart b/lib/presentation/providers/repository_provider.dart new file mode 100644 index 0000000..265aa73 --- /dev/null +++ b/lib/presentation/providers/repository_provider.dart @@ -0,0 +1,13 @@ +import 'package:flutter/foundation.dart' show kIsWeb; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import '../../data/datasources/pokemon_local_datasource.dart'; +import '../../data/datasources/pokemon_remote_datasource.dart'; +import '../../data/repositories/pokemon_repository_impl.dart'; +import '../../domain/repositories/pokemon_repository.dart'; + +/// Point d'injection unique du repository. Sur le web, pas de SQLite (local = null). +final pokemonRepositoryProvider = Provider((ref) { + final remote = PokemonRemoteDataSource(); + final local = kIsWeb ? null : PokemonLocalDataSource(); + return PokemonRepositoryImpl(remote: remote, local: local); +});