2022-06-05 19:36:32 +00:00
|
|
|
import 'package:flutter/material.dart';
|
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';
|
|
|
|
|
2022-06-05 19:36:32 +00:00
|
|
|
import 'package:selfprivacy/config/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
|
2022-06-05 22:40:34 +00:00
|
|
|
void onError(
|
|
|
|
final BlocBase<dynamic> bloc,
|
|
|
|
final Object error,
|
|
|
|
final StackTrace stackTrace,
|
|
|
|
) {
|
2022-06-05 19:36:32 +00:00
|
|
|
final NavigatorState navigator = getIt.get<NavigationService>().navigator!;
|
2021-02-15 18:58:29 +00:00
|
|
|
|
|
|
|
navigator.push(
|
2021-01-13 16:45:46 +00:00
|
|
|
materialRoute(
|
|
|
|
BrandError(
|
|
|
|
error: error,
|
|
|
|
stackTrace: stackTrace,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
2022-05-24 18:55:39 +00:00
|
|
|
super.onError(bloc, error, stackTrace);
|
2021-01-13 16:45:46 +00:00
|
|
|
}
|
|
|
|
}
|