Application propre sans erreurs. Bonne base sur laquelle repartir de zero en cas de soucis majeurs.
This commit is contained in:
22
lib/config/injection/injection.dart
Normal file
22
lib/config/injection/injection.dart
Normal file
@@ -0,0 +1,22 @@
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import '../../data/datasources/user_remote_data_source.dart';
|
||||
import '../../data/datasources/user_repository_impl.dart';
|
||||
import '../../domain/usecases/get_user.dart';
|
||||
|
||||
final sl = GetIt.instance;
|
||||
|
||||
void init() {
|
||||
// Register Http Client
|
||||
sl.registerLazySingleton(() => http.Client());
|
||||
|
||||
// Register Data Sources
|
||||
sl.registerLazySingleton(() => UserRemoteDataSource(sl()));
|
||||
|
||||
// Register Repositories
|
||||
sl.registerLazySingleton(() => UserRepositoryImpl(remoteDataSource: sl()));
|
||||
|
||||
// Register Use Cases
|
||||
sl.registerLazySingleton(() => GetUser(sl()));
|
||||
}
|
||||
18
lib/config/router.dart
Normal file
18
lib/config/router.dart
Normal file
@@ -0,0 +1,18 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:afterwork/presentation/screens/home/home_screen.dart';
|
||||
|
||||
class AppRouter {
|
||||
static Route<dynamic> generateRoute(RouteSettings settings) {
|
||||
switch (settings.name) {
|
||||
case '/':
|
||||
return MaterialPageRoute(builder: (_) => const HomeScreen());
|
||||
// Ajoute d'autres routes ici
|
||||
default:
|
||||
return MaterialPageRoute(
|
||||
builder: (_) => const Scaffold(
|
||||
body: Center(child: Text('Page not found')),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user