handleException method

bool handleException(
  1. FlutterErrorDetails details
)

Handle the Exception

Implementation

bool handleException(FlutterErrorDetails details) {
  // ignore: prefer_final_locals
  var handled = false;
  //
  if (details.exceptionAsString().contains('Zone mismatch.')) {
    //
    handled = true;

    details = FlutterErrorDetails(
      exception: details.exception,
      stack: details.stack,
      library: 'run_app.dart',
      context: ErrorHint(
        "with unnecessary call for binding.\nPlease remove call, WidgetsFlutterBinding.ensureInitialized();\nIf still required, please set the 'runZoneGuard' parameter to false: runApp(runZoneGuard: false)",
      ),
      informationCollector: details.informationCollector,
    );
  }
  // Log the error
  logErrorDetails(details);
  return handled;
}