Maybe<T>.fromRequest constructor

Maybe<T>.fromRequest(
  1. RequestStatus<T> input
)

Factory for helping building a Maybe from a RequestStatus input. It produces a Just if the input is Succeeded, and a Nothing otherwise

Implementation

factory Maybe.fromRequest(RequestStatus<T> input) {
  return switch (input) {
    Succeeded(:final data) => Just(data),
    _ => Nothing<T>(),
  };
}