Modddels
HomeGithubPub.dev
v0.2
v0.2
  • Motivation
  • Setup
  • Generalities
    • Modddels Overview
    • Validations & Validation steps
    • Structure of a Modddel
    • Member parameters & Dependency parameters
    • Usage
      • Data equality & toString
      • Pattern matching
      • Reading the fields
      • Reading the failures
      • CopyWith
  • ValueObjects
    • ValueObjects Overview
    • Creating a ValueObject
  • Entities
    • Entities Overview
    • ContentValidation & ContentFailure
    • ValidationSteps in Entities
    • SimpleEntity
      • Creating a SimpleEntity
      • Special Cases
    • IterableEntity & Iterable2Entity
      • IterableEntity / Iterable2Entity kinds
      • The Type Template
      • Creating an IterableEntity / Iterable2Entity
      • InvalidMembers Description
      • Special Cases
      • Creating your own IterableEntity / Iterable2Entity kind
  • Advanced Notions
    • The NullFailure Annotation
    • Using multiple parameters annotations
    • Class Hierarchy of ValueObjects
    • Class Hierarchy of Entities
    • Models that are always valid / invalid
  • Union of Modddels
    • Union of Modddels Overview
    • Basic Usage
    • Case-modddels pattern matching
    • Default Factory Constructor
    • Shared Properties
    • The Validate Methods
    • CopyWith
  • Unit-Testing Of Modddels
    • Unit-Testing Overview
    • Available Tests
    • Customizing Tests
  • Additional Information
    • Using type aliases
    • Re-running the generator
    • All Available Modddels
    • VsCode Snippets
Powered by GitBook
On this page
  • Installation
  • Running the Generator

Setup

PreviousMotivationNextModddels Overview

Last updated 1 year ago

Installation

Add these dev dependencies :

dev_dependencies:
  build_runner:
  modddels:

Then, add ONE of these dependencies :

dependencies:
  # If you use fpdart for functional programming
  modddels_annotation_fpdart:
  # If you use dartz for functional programming
  modddels_annotation_dartz:

This package uses the functional programming types Option and Either.

  • If you use as a functional programming package, install modddels_annotation_fpdart.

  • If you use as a functional programming package, install modddels_annotation_dartz.

If you're not familiar with functional programming, I recommend using , which is well documented and contains all the resources you need to learn the core concepts. You only need to know about Option and Either to use this package.

Running the Generator

In your package directory, run the following command :

dart run build_runner build

For flutter projects, you can instead run :

flutter pub run build_runner build

See for more commands.

fpdart
dartz
fpdart
build_runner