Fos<F extends Failure, S> class abstract

Constructors

Fos.new()
const
Fos.failure(F failure)
When you want to return failure use this method failure is the failure object example: try {
factory
Fos.success(S success)
use this method to return success success is the success object example: try { final user = await findUsers("$params"); return Fos.success(user); }
factory

Properties

get → dynamic
no setter
hashCode int
The hash code for this object.
no setterinherited
isFailure bool
when you want verify if the result is failure
no setter
isSuccess bool
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
on<Result>(Result onFailure(F failure), Result onSuccess(S success)) → Result
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

errors Map<Object, Failure>
no setter

Static Methods

addErrors(Map<Object, Failure> errors) → dynamic
Add errors to the existing errors.
initErrors(Map<Object, Failure> errors) → dynamic
Initialize errors and uses your custom errors.
toFailure<R>(Object exception) Future<Fos<Failure, R>>
use this method to convert exception to failure example: try { final user = await findUsers("$params"); return Fos.success(user); } catch (e) { return Fos.toFailure(e); }