Failure Object

This package includes a base Failure object that all exceptions are converted into. In order to create custom failure objects, they must extend the base Failure object. For example, you might create a NetworkFailure object to represent a specific type of failure related to network issues. To do this, you would define the NetworkFailure class as follows:

class NetworkFailure extends Failure {
  const NetworkFailure({super.message = 'A network failure occurred'});

Then, you can use the NetworkFailure class to represent failures related to network issues in your code.

Last updated