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

24 lines
649 B
Dart
Raw Normal View History

2021-01-13 16:45:46 +00:00
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);
}
}