Fos<F extends Failure, S>.failure constructor
Fos<F extends Failure, S>.failure (
- F failure
When you want to return failure use this method
failure
is the failure object
example:
try {
} on NetworkConnectionException catch (e) { return Fos.failure(NetworkConnectionFailure()); }on ServerException catch (e) { return Fos.failure(ServerFailure()); } catch (e) { return Fos.toFailure(UnknownFailure()); }
Implementation
factory Fos.failure(F failure) => _Failure(failure);