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. -
OptionPropagateShortcut
on Option<
T> Function() -
Provides the
~
shortcut for functions that return Option to allow propagating unwrapped None values up the call stack. -
OptionPropagateShortcutAsync
on Future<
Option< Function()T> > -
Provides the
~
shortcut for asynchronous functions that return Option to allow propagating unwrapped None values up the call stack. -
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
-
propagateOption<
T> (Option< T> fn()) → Option<T> - Executes the given function, returning the returned Option value.
-
propagateOptionAsync<
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.