selfprivacy.org.app/lib/config/bloc_observer.dart

25 lines
620 B
Dart
Raw Normal View History

2021-01-13 16:45:46 +00:00
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:selfprivacy/ui/components/error/error.dart';
import 'package:selfprivacy/utils/route_transitions/basic.dart';
2021-02-15 18:58:29 +00:00
import 'get_it_config.dart';
2021-01-13 16:45:46 +00:00
2021-02-15 18:58:29 +00:00
class SimpleBlocObserver extends BlocObserver {
SimpleBlocObserver();
2021-01-13 16:45:46 +00:00
@override
void onError(Cubit cubit, Object error, StackTrace stackTrace) {
2021-02-15 18:58:29 +00:00
final navigator = getIt.get<NavigationService>().navigator;
navigator.push(
2021-01-13 16:45:46 +00:00
materialRoute(
BrandError(
error: error,
stackTrace: stackTrace,
),
),
);
super.onError(cubit, error, stackTrace);
}
}