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. Tutorial
  2. Implementing the Domain Layer

Core Dependencies

PreviousImplementing the Domain LayerNextCreating an Entity

Last updated 2 years ago

1. Add the dependencies

In the note_app/modules/domain/ directory, include the following dependencies in the pubspec.yaml:

dependencies:
    codenic_bloc_use_case: {{LATEST_VERSION}}
    codenic_exception_converter: {{LATEST_VERSION}}

Here's an overview of the packages:

  • Provides a suite of class templates extending that we can use to make our .

  • This package offers a base Failure class that we will extend to create custom classes. In addition, this provides a utility for converting exceptions into Failure objects.

Fetch the dependencies:

flutter pub get modules/domain

Tip: You can use a to fetch the dependencies for all submodules in one go.

2. Add the shared dependencies to the barrel file

On the note_app/modules/domain/lib/domain.dart barrel file, export the packages to share them with the dependent modules:

export 'package:codenic_bloc_use_case/codenic_bloc_use_case.dart';
export 'package:codenic_exception_converter/codenic_exception_converter.dart';
codenic_bloc_use_case
BLoC Cubits
codenic_exception_converter
Use Cases
Failure
script