chainFromList method

Function chainFromList(
  1. covariant List<Function?> callbacks
)

Returns a strongly-typed chained callback that calls through to the list of provided callbacks in order. Useful for executing multiple callbacks where only a single callback is accepted.

Returns false if one or more of the provided callbacks returns false.

Gracefully handles when callbacks is empty or its items are null, always returning a callable function.

Implementation

Function chainFromList(covariant List<Function?> callbacks) =>
    callbacks.fold(null, chain) ?? noop;