onError property

void Function(Object error)? onError
final

Called when the document fails to load or parse.

Fires for every failure path — a network/asset load error, or a corrupt or encrypted PDF that fails inside the renderer. Use it to log the error or surface an app-level message (e.g. a snackbar). The viewer still shows its own error state (see errorBuilder); this callback is purely a hook.

Implementation

final void Function(Object error)? onError;