Effect<Value>.run constructor

const Effect<Value>.run(
  1. Value runner(), {
  2. Value onError(
    1. Object error,
    2. StackTrace stackTrace
    )?,
})

Runs the synchronous runner immediately when the effect is executed and emits its return value. Errors can be transformed via onError.

Example:

final generateId = Effect.run(() => uuid.v4());

Implementation

const factory Effect.run(
  Value Function() runner, {
  Value Function(Object error, StackTrace stackTrace)? onError,
}) = RunEffect<Value>;