fold method
      
  
Result<Option<Object> > 
fold(
    
- @noFutures Option<Object> ? onSome(- Some<T> some
 
- Some<
- @noFutures Option<Object> ? onNone(- None<T> none
 
- None<
override
    Folds the two cases of this Option into a single Result.
The onSome and onNone functions must return a new Option.
Implementation
@override
@pragma('vm:prefer-inline')
Result<Option<Object>> fold(
  @noFutures Option<Object>? Function(Some<T> some) onSome,
  @noFutures Option<Object>? Function(None<T> none) onNone,
) {
  try {
    return Ok(onSome(this) ?? this);
  } catch (error) {
    return Err(error);
  }
}