init method
This function must be call at the begining of the initilalization.
Call all the init function of each sdk provide in the diagnostic list and
track FlutterError and PlatformDispatcher.
Implementation
@override
Future<void> init() async {
await super.init();
FlutterError.onError = (details) {
for (Diagnostic diagnostic in diagnostic) {
diagnostic.captureException(
exception: DiagnosticExpection(
level: DiagnosticLevel.error,
throwable: details.exception,
stackTrace: details.stack,
),
);
}
};
PlatformDispatcher.instance.onError = (exception, stackTrace) {
for (Diagnostic diagnostic in diagnostic) {
diagnostic.captureException(
exception: DiagnosticExpection(
level: DiagnosticLevel.error,
throwable: exception,
stackTrace: stackTrace,
),
);
}
return false;
};
}