Codenic Clean Architecture
  • Introduction
  • The Clean Architecture
    • Presentation Layer
    • Domain Layer
    • Infrastructure Layer
  • Tutorial
    • Overview
    • Creating a Flutter Modular Project
      • Tips for Managing a Modular Project
    • Implementing the Domain Layer
      • Core Dependencies
      • Creating an Entity
      • Creating a Failure
      • Creating a Repository Interface
      • Creating Use Cases
        • CRUD Operations (Runner)
        • Data Streams (Watcher)
    • Implementing the Infrastructure Layer
      • External Dependencies
      • Creating a Data Model
      • Creating a Data Source
      • Implementing a Repository
    • Implementing the Presentation Layer
      • External Dependencies
      • Dependency Injection and Service Locator
      • Widgets
        • Snackbar Handler
        • Global Blocs Widget
        • Note Widgets
  • Packages
    • Codenic Bloc Use Case
      • Runner
      • Watcher
    • Codenic Logger
      • Usage
      • Example
      • Modifying the Logger
      • Integrating Firebase Crashlytics to the logger
    • Codenic Exception Converter
      • Failure Object
      • Exception Converter
      • Exception Converter Suite
      • Example
Powered by GitBook
On this page
  1. Packages
  2. Codenic Exception Converter

Failure Object

PreviousCodenic Exception ConverterNextException Converter

Last updated 2 years ago

This package includes a base 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.

Failure