init method
Implementation
Future<void> init() async {
FlutterError.onError = (details) async {
final error = details.exception;
final stack = details.stack ?? StackTrace.current;
await _saveCrash(
threadName: Isolate.current.debugName ?? 'main',
stackTrace: 'Unhandled Exception: $error\n$stack',
crashType: error.runtimeType.toString(),
);
};
PlatformDispatcher.instance.onError = (error, stack) {
_saveCrash(
threadName: Isolate.current.debugName ?? 'main',
stackTrace: 'Unhandled Exception: $error\n$stack',
crashType: error.runtimeType.toString(),
);
return true; // prevent default crash
};
}