DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk4 min

Freezed in Flutter: What to Know Before You Stop Using It

Dart 3 provides native pattern matching and primary constructors, but Freezed still offers generated model features. Here’s how to decide what to keep or replace in a Flutter project.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Stopping use of Freezed can make sense if a Flutter project only needs features Dart now provides natively. But Dart’s sealed classes, pattern matching, and primary constructors do not replace everything Freezed generates. The right choice depends on which model features your app uses, its JSON setup, build workflow, and Dart SDK constraints.

What Freezed does in a Flutter project

Freezed is a Dart code-generation package for immutable data classes and related model features. Depending on how you use it, generated code can provide constructors, copyWith, equality, hashCode, toString, tagged unions, nested classes, and cloning. Its JSON workflow integrates with json_serializable; Freezed is not itself a standalone JSON generator. The package documentation describes a setup involving annotations, part files, and build_runner. Freezed package documentation

As an Amazon Associate I earn from qualifying purchases.

Those features are separable in practice. A project can use native Dart pattern matching while keeping Freezed for generated model behavior, or use Freezed only for models that benefit from it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Which Freezed use cases Dart has replaced

Pattern matching and unions

Dart 3 includes sealed classes and pattern matching. Freezed’s documentation says its generated when and map helpers are legacy utilities and recommends moving toward native Dart syntax, particularly switch expressions. That can remove the need for Freezed-generated pattern-matching helpers, but it does not remove Freezed’s other model features. Freezed package documentation

Primary constructor syntax

As of the Freezed repository documentation checked on October 7, 2026, Dart 3.13 primary constructors are stable and can be used without Freezed. The same documentation notes that Freezed remains an option when generated equality, toString, copyWith, or related behavior is useful. Check your project’s actual Dart SDK constraint before adopting syntax that requires a newer SDK. Freezed project documentation

Why removing Freezed is not automatically an upgrade

Flutter’s architecture recommendations strongly favor immutable data models and explicitly say, “Use freezed or built_value to generate immutable data models.” The guidance also cautions that code-generation packages can add significant build time in projects with many models; it does not provide a numeric threshold or estimate. So the practical question is whether generation is a meaningful cost in your own local and CI workflows, weighed against the code and behavior you would need to replace. Flutter architecture recommendations

Removing the package can also affect more than declarations. Existing call sites may rely on generated copying, equality, serialization behavior, or union handling. Replacing only the syntax while overlooking those contracts can change how state comparisons, tests, API mapping, or UI updates behave.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A project-level decision framework

Question If yes If no
Do your models use generated copyWith, equality, hashCode, toString, nested types, or cloning? Keep Freezed for the models that need those generated behaviors, or plan explicit replacements. Native Dart declarations may cover more of your requirements.
Do you use Freezed unions mainly for exhaustive branching? Evaluate sealed classes and native pattern matching against your current cases. That Dart 3 change may not be relevant to your decision.
Do your models map API JSON? Inventory the existing json_serializable annotations, converters, and generated mapping before changing declarations. Serialization is less likely to constrain this decision.
Does code generation materially affect your project’s build workflow? Compare the actual local and CI cost with the work and maintenance of alternatives. A migration may offer little workflow benefit on this axis.
Does the project SDK support the native syntax you want, and can the team maintain it? Native patterns may reduce reliance on package-specific APIs. Keep the current approach or upgrade the SDK deliberately before migrating.

There is no universal migration-cost figure established by the cited guidance. Estimate it in your own codebase by tracing generated APIs to their call sites, checking serialized shapes, and reviewing tests that depend on equality or union behavior.

How to move away selectively

  1. Inventory actual usage. Search model declarations and call sites for generated methods, JSON annotations, and union-specific helpers. Separate syntax conveniences from runtime behavior the app relies on.
  2. Check SDK constraints. Confirm the Dart SDK range in the project configuration and ensure every developer and build environment can use the target language features.
  3. Choose a scope. You can replace pattern matching while retaining Freezed, migrate a small group of models, or keep Freezed where generated behavior remains valuable. Avoid treating the change as all-or-nothing.
  4. Preserve serialization and behavior. For each migrated model, verify JSON encoding and decoding, equality expectations, copying behavior, and all branches previously handled by generated union helpers.
  5. Validate the build and tests. Regenerate code where required, run the project’s tests, and compare build behavior in the environments that matter to your team.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

The practical conclusion

Dart 3 makes some reasons to use Freezed less compelling, especially generated pattern-matching helpers and primary-constructor syntax. It does not make Freezed obsolete: generated immutable-model features and JSON integration may still fit a project well. Decide based on the features your code actually uses, the SDK your team supports, and the measurable cost of your current generation workflow—not on a blanket claim that one approach is best.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.