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. -
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.
Exceptions / Errors
- OptionError
- Represents an error thrown by a mishandled Option type value.