Option<T> constructor
Option<T> (
- T? value
Creates a Some with the given value
, if it is not null
, or a None otherwise.
Examples
// prints "Some(2)"
print(Option(2));
// prints "None"
print(Option<int>(null));
Implementation
factory Option(T? value) => value != null ? Some(value) : None<T>();