onError property Null safety

FlutterExceptionHandler? onError
read / write

Called whenever the Flutter framework catches an error.

The default behavior is to call presentError.

You can set this to your own function to override this default behavior. For example, you could report all errors to your server. Consider calling presentError from your custom error handler in order to see the logs in the console as well.

If the error handler throws an exception, it will not be caught by the Flutter framework.

Set this to null to silently catch and ignore errors. This is not recommended.

Do not call onError directly, instead, call reportError, which forwards to onError if it is not null.

See also:

Implementation

static FlutterExceptionHandler? onError = presentError;