Skip to main content
Guide · Architecture

Flutter Data Models: JSON vs Freezed vs Equatable vs Plain Dart

Plain Dart, hand-written JSON, Freezed and Equatable models compared, with the trade-offs of each and which to use for API responses, Bloc or Riverpod state, and local data.

Afaq Zahir, author

Afaq Zahir

Flutter mobile product engineer

Published Updated 6 min read

On this page
  1. 1. Plain Dart Model (POJO – Plain Old Dart Object)
  2. 2. JSON Model (Using fromJson and toJson)
  3. 3. Freezed Model (Immutable & Auto-generated)
  4. 4. Equatable Model (Value Equality & Less Boilerplate)
  5. Model Types Comparison
  6. Which One Should You Use?
  7. Frequently Asked Questions

Quick answer

Choosing the right data modeling strategy in Flutter depends on project scale: Plain Dart classes for minimal single-screen prototypes, Equatable for value-based equality in Bloc/Riverpod states, and Freezed with json_serializable for robust immutable models with copyWith, pattern matching, and union types.

Key takeaways

  • Freezed provides type-safe copyWith, immutability, and JSON serialization out of the box.
  • Equatable simplifies value equality comparison without code-generation overhead.
  • Always handle null safety, default fallbacks, and ISO-8601 date parsing in fromJson factory methods.
  • Separate API DTO models from domain entities in production Clean Architecture.

Flutter apps use four common kinds of data model: a plain Dart class, a class with hand-written JSON parsing, a Freezed class and an Equatable class. Which one fits depends on whether the data comes from an API, sits in local storage or holds UI state in a ViewModel. Pair them with Dart extensions for formatting and conversion helpers that do not belong on the model itself.

Each section below shows the model, what it costs you and when to pick it.

1. Plain Dart Model (POJO – Plain Old Dart Object)

A simple class with properties and constructors. It does not contain any JSON parsing or external dependencies.

  • Use Case: Basic data representation, local state management, mockup items.
  • Pros: Lightweight, fast to create, zero dependencies.
  • Cons: No serialization/deserialization out of the box, manual conversions required when connecting to databases or APIs.

Example of a Plain Old Dart Object:

Plain Dart Model Example

2. JSON Model (Using fromJson and toJson)

A class that includes manual parsing factories and serialization maps to parse JSON responses from backend services.

  • Use Case: When dealing with REST APIs and simple network payloads.
  • Pros: Structured serialization & deserialization, zero external code-generation dependencies.
  • Cons: Hand-writing fromJson and toJson is error-prone and time-consuming for large models, unless you use generators like json_serializable.

Example of a JSON Model with manual parsing:

JSON Model Example

3. Freezed Model (Immutable & Auto-generated)

A powerful code-generator based model system using the freezed and json_serializable packages.

  • Use Case: When working with immutable state management (like Riverpod or BLoC), deep nested configurations, and API structures.
  • Pros: Removes boilerplate, automatically creates copyWith/toString/equality operators, enforces immutability, supports union classes and pattern matching.
  • Cons: Requires running code generation commands (dart run build_runner build) which can slow down build speeds in massive codebases.

Why use Freezed?

  • Auto-generates constructors & properties.
  • Supports copyWith for non-destructive state mutations.
  • Deep equality comparisons out of the box.
  • Integrates seamlessly with advanced state management solutions.

Example of a Freezed model definition:

Freezed Model Example

4. Equatable Model (Value Equality & Less Boilerplate)

A model that extends the Equatable package to override value comparison, allowing objects to be compared by their properties rather than their reference address in memory.

  • Use Case: When using BLoC/Cubit state management to verify state transitions and prevent redundant UI rebuilds.
  • Pros: Prevents unnecessary UI repaints, removes manual == and hashCode overrides.
  • Cons: Requires extending a base class (Equatable) and maintaining a list of properties in the props getter.

Model Types Comparison

Flutter Models Comparison

Which One Should You Use?

  • For REST APIs? Use Freezed or JSON models to parse network payloads safely.
  • For State Management? Use Freezed (especially with Riverpod/StateNotifier) or Equatable (with BLoC) to manage object equality and stream updates cleanly.
  • For Local Layout Data? Use Plain Dart models to avoid dependencies when no serialization or value comparisons are needed.

Frequently Asked Questions

Which Flutter model type should I use for REST API data?

Use Freezed or JSON models to parse network payloads safely. A JSON model hand-writes fromJson and toJson with no code generation, which is error-prone for large models unless you use json_serializable. Freezed adds immutability, copyWith and equality, at the cost of running build_runner code generation.

What is the difference between Freezed and Equatable?

Freezed generates constructors, copyWith, toString and equality operators, enforces immutability and supports union classes. Equatable only adds value equality, by extending a base class and listing properties in the props getter. A common pairing is Freezed with Riverpod and Equatable with BLoC; compare those in Riverpod vs BLoC.

When is a plain Dart model enough?

A plain Dart model is enough for local layout data, mock items and basic local state where no serialization or value comparison is needed. It is lightweight, fast to create and has zero dependencies, but it has no serialization out of the box, so conversions to databases or APIs must be written by hand.

Does Freezed slow down my Flutter build?

Freezed relies on code generation through dart run build_runner build, which can slow down build speeds in massive codebases. In exchange it removes boilerplate and automatically creates copyWith, toString and equality operators. Whether that trade is worth it depends on how large your models and your codebase are.

Special thanks to Ubaid Ullah and MUHAMMAD UZAIR for their support and insights on mobile architectures!

Afaq Zahir

Written by

Afaq Zahir

Flutter mobile product engineer with 4+ years shipping 20+ apps to the App Store and Google Play. Led Flutter teams at Metasense and Apptex.

GitHub ↗LinkedIn ↗Last reviewed
Book a call