selfprivacy.org.app/lib/config/bloc_observer.dart
2021-01-13 17:45:46 +01:00

24 lines
649 B
Dart

import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:selfprivacy/ui/components/error/error.dart';
import 'package:selfprivacy/utils/route_transitions/basic.dart';
class SimpleBlocObserver extends BlocObserver {
final GlobalKey<NavigatorState> navigatorKey;
SimpleBlocObserver({this.navigatorKey});
@override
void onError(Cubit cubit, Object error, StackTrace stackTrace) {
navigatorKey.currentState.push(
materialRoute(
BrandError(
error: error,
stackTrace: stackTrace,
),
),
);
super.onError(cubit, error, stackTrace);
}
}