Option<T> extension type

Option represents the union of two types - Some<T> and None. As an extension Option$type of T?, Option<T> has the same runtime cost of T? with the advantage of being able to chain null specific operations.

on
  • T?
Available extensions

Constructors

Option(_OptionEarlyReturnFunction<T> fn)
Creates a context for early return, similar to "Do notation". Works like the Rust "?" operator, which is a "Early Return Operator". Here "$" is used as the "Early Return Key". when "$" is used on a type _None, immediately the context that "$" belongs to is returned with None(). e.g.
factory
Option.from(T? v)
Converts from T? to Option<T>.

Properties

v → T?
final

Static Methods

async<T>(_OptionAsyncEarlyReturnFunction<T> fn) Future<Option<T>>
Creates a context for async early return, similar to "Do notation". Works like the Rust "?" operator, which is a "Early Return Operator". Here "$" is used as the "Early Return Key". when "$" is used on a type _None, immediately the context that "$" belongs to is returned with None(). e.g.