Skip to content

IListOptionOps<A>

extension IListOptionOps<A> on IList<Option<A>>

Operations avaiable when IList elements are of type Option.

Methods

sequence() extension

Option<IList<A>> sequence()

Accumulates all elements in this list as one Option. If any element is a None, None will be returned. If all elements are Some, then the entire list is returned, wrapped in a Some.

Available on IList<A>, provided by the IListOptionOps<A> extension

Implementation
dart
Option<IList<A>> sequence() => traverseOption(identity);

unNone() extension

IList<A> unNone()

Returns a new list with all None elements removed.

Available on IList<A>, provided by the IListOptionOps<A> extension

Implementation
dart
IList<A> unNone() => foldLeft(nil(), (acc, elem) => elem.fold(() => acc, (a) => acc.appended(a)));