ExceptionSupplier typedef

ExceptionSupplier = Object Function()

A function that returns an exception object to be thrown when needed.

Useful for lazy error throwing or assertion mechanisms.

{@tool snippet}

final ExceptionSupplier notFound = () => Exception('Item not found');
throw notFound();

{@end-tool}

Implementation

typedef ExceptionSupplier = Object Function();