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.

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.

Implementation

static FlutterExceptionHandler? onError = presentError;