runApp function
Add an Error Handler right at the start.
Implementation
void runApp(m.Widget app) {
// Don't call WidgetsFlutterBinding.ensureInitialized()
// since the runApp() function itself calls it internally
// Instantiate the app's error handler.
final handler = c.AppErrorHandler();
// Isolate is not available on the Web
if (!kIsWeb) {
//
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);
}
m.runApp(app);
}