update
feat(api_service): Update try-catch funtion and handle exception update(loading_animation): Update loading animation using Lottie
This commit is contained in:
@@ -12,6 +12,7 @@ import '../product/base/bloc/base_bloc.dart';
|
||||
import '../product/services/api_services.dart';
|
||||
import '../feature/bell/bell_model.dart';
|
||||
import '../feature/settings/profile/profile_model.dart';
|
||||
import '../product/shared/shared_snack_bar.dart';
|
||||
|
||||
class MainBloc extends BlocBase {
|
||||
APIServices apiServices = APIServices();
|
||||
@@ -42,10 +43,16 @@ class MainBloc extends BlocBase {
|
||||
@override
|
||||
void dispose() {}
|
||||
|
||||
void getUserProfile() async {
|
||||
String data = await apiServices.getUserDetail();
|
||||
User user = User.fromJson(jsonDecode(data));
|
||||
sinkUserProfile.add(user);
|
||||
void getUserProfile(BuildContext context) async {
|
||||
try {
|
||||
User user = await apiServices.getUserDetail();
|
||||
sinkUserProfile.add(user);
|
||||
} catch (e) {
|
||||
if (!context.mounted) return;
|
||||
showErrorTopSnackBarCustom(
|
||||
context, e.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
getFCMTokenAndPresentations() async {
|
||||
|
||||
Reference in New Issue
Block a user