Option<Value>.from constructor

Option<Value>.from(
  1. dynamic value
)

Constructs a Option from a dynamic value If the value is Option it will return the value itself If the value is Value it will return Some<Value> otherwise returns None

Implementation

factory Option.from(dynamic value) {
  if (value is Option<Value>) {
    return value;
  } else if (value is Value) {
    return Some(value);
  } else {
    return const None();
  }
}