flatMap<R extends Object> method

  1. @override
Option<R> flatMap<R extends Object>(
  1. @noFutures Option<R> noFutures(
    1. T value
    )
)
override

Maps an Option<T> to Option<R> by applying a function that returns another Option.

⚠️ Callback must not throw

Option<R> has no Err variant — there is no slot to record a failure here. If your transformation can fail, use fold or transf (both of which return a Result that can hold an Err), or lift the call via Sync(() => f(value)) to land in the safer Result world.

Implementation

@override
@pragma('vm:prefer-inline')
Option<R> flatMap<R extends Object>(
  @noFutures Option<R> Function(T value) noFutures,
) {
  return noFutures(value);
}