runApp function
void
runApp(
- Widget app, {
- FlutterExceptionHandler? errorHandler,
- ErrorWidgetBuilder? errorScreen,
- ReportErrorHandler? errorReport,
- bool newErrorHandlers = true,
Add an Error Handler right at the start.
Implementation
// The 'error' parameters are deprecated.
void runApp(
m.Widget app, {
FlutterExceptionHandler? errorHandler,
m.ErrorWidgetBuilder? errorScreen,
v.ReportErrorHandler? errorReport,
bool newErrorHandlers = true,
}) {
// Instantiate the app's error handler.
final handler = v.AppErrorHandler(newErrorHandlers: newErrorHandlers);
Isolate.current.addErrorListener(RawReceivePort((dynamic pair) {
//
if (pair is List<dynamic>) {
final isolateError = pair;
handler.isolateError(
isolateError.first.toString(),
StackTrace.fromString(isolateError.last.toString()),
);
}
}).sendPort);
// Catch any errors attempting to execute runApp();
runZonedGuarded(() {
m.runApp(app);
}, handler.runZonedError);
}