Add HomeCubit and HomeState classes

This commit adds the HomeCubit class along with its corresponding HomeState
class. It also includes necessary imports and updates references to the
previously used SpacesCubit to the new HomeCubit in various files.
handled the multible onCreate -- HomeCubit
This commit is contained in:
Mohammad Salameh
2024-03-24 14:43:13 +03:00
parent c0bfd24751
commit e17c0af144
15 changed files with 72 additions and 77 deletions
+2 -4
View File
@@ -3,7 +3,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:syncrow_app/features/app_layout/bloc/spaces_cubit.dart';
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
import 'package:syncrow_app/features/auth/model/login_with_email_model.dart';
import 'package:syncrow_app/features/auth/model/token.dart';
@@ -42,8 +42,6 @@ class AuthCubit extends Cubit<AuthState> {
static Token token = Token.emptyConstructor();
// (FlutterSecureStorage().read(key :'token'));
login() async {
emit(AuthLoading());
try {
@@ -76,7 +74,7 @@ class AuthCubit extends Cubit<AuthState> {
try {
FlutterSecureStorage storage = const FlutterSecureStorage();
await storage.delete(key: Token.loginAccessTokenKey);
SpacesCubit.clear();
HomeCubit.clear();
emit(AuthLoggedOut());
} on DioException catch (e) {
emit(AuthError(ServerFailure.fromDioError(e).errMessage));