multiple_result_async 0.0.1 copy "multiple_result_async: ^0.0.1" to clipboard
multiple_result_async: ^0.0.1 copied to clipboard

Provide methods to handle Result mapping and chaining with asynchronous operations.

multiple_result_async #

Provide mapping methods for multiple_result's Result<T, E> with asynchronous support/handling, and error (of type E) capture.

Install #

Just add multiple_result_async as dependency. This package does not replace multiple_result.

Usage #

Wrapping a Future<T> to Future<Result<T, E>> #

final result = Future((){...}).toResultOrError<Exception>();

Mapping a Future<Result<T, E>> to Future<Result<U, E>> #

return getDataResult().next(
    onSuccess: (T success) {
        ...
        return Success(processed_value);
    },
    onError: (E error) async {
        ...
        if (is_recoverable_error){
            ...
            return Success(recupered_error);
        }
        ...
        return Error(propagated_error);
    },
);

License #

multiple_result_async is available under the MIT license. See the LICENSE file for more info.

0
likes
0
points
27
downloads

Publisher

verified publisherdig.dev.br

Weekly Downloads

Provide methods to handle Result mapping and chaining with asynchronous operations.

Repository (GitHub)
View/report issues

Topics

#result #utility

License

unknown (license)

Dependencies

multiple_result

More

Packages that depend on multiple_result_async