File tree Expand file tree Collapse file tree 4 files changed +7
-11
lines changed
app/lib/presentation/ui/pages Expand file tree Collapse file tree 4 files changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import 'package:app/presentation/ui/custom/app_theme_switch.dart';
55
66class HomeView extends StatelessWidget {
77 /// Given this is a global cubit, we can access it directly from getIt
8- /// other wise use context.read<AuthCubit>() to read the Cubit under that context
8+ /// otherwise use context.read<AuthCubit>() to read the Cubit under that context
99 AuthCubit get _authCubit => getIt ();
1010
1111 const HomeView ({super .key});
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ class SplashPage extends StatefulWidget {
1111
1212class _SplashPageState extends State <SplashPage > {
1313 /// Given this is a global cubit, we can access it directly from getIt
14- /// other wise use context.read<AuthCubit>() to read the Cubit under that context
14+ /// otherwise use context.read<AuthCubit>() to read the Cubit under that context
1515 AuthCubit get _authCubit => getIt ();
1616
1717 @override
Original file line number Diff line number Diff line change @@ -8,18 +8,14 @@ class AuthCubit extends BaseCubit<AuthState> {
88 final AuthService _authService;
99 AuthCubit (this ._authService) : super (RSuccess (data: AuthStateUnknown ()));
1010
11- Future login (String username, String password) async {
11+ Future < void > login (String username, String password) async {
1212 isLoading ();
1313 final authResult =
1414 await _authService.logInWithCredentials (username, password);
1515
16- authResult.map (
17- success: (_) => isLogin (),
18- error: (failure) {
19- isError (failure);
20- return failure;
21- },
22- );
16+ authResult
17+ ..mapSuccess ((_) => isLogin ())
18+ ..mapError ((failure) => isError (failure));
2319 }
2420
2521 Future <void > onValidate () async {
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import 'package:get_it/get_it.dart';
55
66class DomainInit {
77 static Future <void > initialize (GetIt getIt) async {
8- //Services (with dependencies to repositories)
8+ //Services
99 getIt.registerLazySingleton (() => AuthService (getIt ()));
1010
1111 //Global Cubits
You can’t perform that action at this time.
0 commit comments