common/result/result library

Classes

Failure<T>
Class representing a failed result.
Result<T>
Result class to handle success and failure states.
Success<T>
Class representing a successful result.

Functions

tryCall<S>(FutureOr<S> fn(), {Future<Result<S>> onError(Exception error)?}) Future<Result<S>>
Executes the given API call fn. When the call succeeds, Result.success is returned with the response. When the call fails the optional onError is executed and the exceptions are handled. If there is no onError provided, an error of type BaseError is returned in Result.failure.