option library
This is the option
library, containing only the Option type and its helpers.
This library can be imported via:
import 'package:option_result/option.dart';
If you want to import both Option
and Result
types, consider importing the
combined library:
import 'package:option_result/option_result.dart';
Classes
Extensions
-
OptionFlatten
on Option<
Option< T> > -
Provides the
flatten()
method to Option type values that hold another Option. -
OptionFutureOrUnwrap
on FutureOr<
Option< T> > -
Provides
call
functionality to FutureOr values that complete with an Option type value. -
OptionFutureUnwrap
on Future<
Option< T> > -
Provides
call
functionality to Future values that complete with an Option type value. -
OptionTranspose
on Option<
Result< T, E> > -
Provides the
transpose()
method to Option type values that hold a Result. -
OptionUnzip
on Option<
(T, U)> -
Provides the
unzip()
method to Option type values that hold a Record of two values.
Functions
-
catchOption<
T> (Option< T> fn()) → Option<T> - Executes the given function, returning the returned Option value.
-
catchOptionAsync<
T> (FutureOr< Option< fn()) → Future<T> >Option< T> > - Executes the given function asynchronously, returning the returned Option value.
Typedefs
-
FutureOption<
T> = Future< Option< T> > -
Represents a Future that completes with an Option of the given type
T
. -
FutureOrOption<
T> = FutureOr< Option< T> > -
Represents a FutureOr that is or completes with an Option of the given type
T
.
Exceptions / Errors
- OptionError
- Represents an error thrown by a mishandled Option type value.