β–²

Flutter Gems is a curated list of 7250+ useful Dart & Flutter packages that are categorized based on functionality.

Discord Medium LinkedIn X

Top Flutter Code Generator and Serialization (JSON) packages

Last updated: May 18, 2026

Code generation automates the creation of tedious boilerplate codeβ€”such as JSON serialization, API clients, and routing tablesβ€”drastically reducing human error and development time.

Best Practices for Code Generation

  • Build Runner Optimization: The build_runner command can take minutes to execute on massive projects. Use the build.yaml file to restrict code generation to specific directories (like lib/models/) to significantly speed up the build process.
  • Commit Generated Files: Always commit your generated .g.dart or .freezed.dart files to version control. Forcing every developer (or your CI/CD server) to run build_runner from scratch on a fresh clone is a massive waste of time.
  • Freezed for Models: Use the freezed package for complex data models. It automatically generates union types, deep copy mechanisms (copyWith), and immutable state structures that are impossible to maintain manually.

The complete list of Code Generators, JSON Serialization (json_serializable), and Boilerplate Automation packages is provided below.


json_annotation
πŸ‘ 1.3K   β¬‡οΈ 7.8M
Dart 3 compatible
Maintenance Status: Good

Classes and helper functions that support JSON code generation via the `json_serializable` package.

json_serializable
πŸ‘ 3.93K   β¬‡οΈ 2.7M
Dart 3 compatible
Maintenance Status: Good

Automatically generate code for converting to and from JSON by annotating Dart classes.

freezed
πŸ‘ 4.49K   β¬‡οΈ 2M
Dart 3 compatible
Maintenance Status: Good

Code generation for immutable classes that has a simple syntax/API without compromising on the features.

source_gen
πŸ‘ 189   β¬‡οΈ 4.4M
Dart 3 compatible
Maintenance Status: Good

Source code generation builders and utilities for the Dart build system

freezed_annotation
πŸ‘ 553   β¬‡οΈ 2.8M
Dart 3 compatible
Maintenance Status: Good

Annotations for the freezed code-generator. This package does nothing without freezed too.

source_helper
πŸ‘ 19   β¬‡οΈ 2.8M
Dart 3 compatible
Maintenance Status: Good

Utilities to help with Dart source code generation. Includes utilities for properly generating String literals from any String value.

flutter_gen
πŸ‘ 1.73K   β¬‡οΈ 112.8K
Dart 3 compatible
Maintenance Status: Good

The Flutter code generator for your assets, fonts, colors, … β€” Get rid of all String-based APIs.

pigeon
πŸ‘ 1.23K   β¬‡οΈ 428.5K
Dart 3 compatible
Maintenance Status: Good

Code generator tool to make communication between Flutter and the host platform type-safe and easier.

riverpod_generator
πŸ‘ 430   β¬‡οΈ 733.3K
Dart 3 compatible
Maintenance Status: Good

A code generator for Riverpod. This both simplifies the syntax empowers it, such as allowing stateful hot-reload.

ffigen
πŸ‘ 332   β¬‡οΈ 807.7K
Dart 3 compatible
Maintenance Status: Good

Generator for FFI bindings, using LibClang to parse C, Objective-C, and Swift files.

asn1lib
πŸ‘ 26   β¬‡οΈ 1.1M
Dart 3 compatible
Maintenance Status: Good

An ASN1 parser library for Dart. Encodes / decodes from ASN1 Objects to BER bytes

riverpod_annotation
πŸ‘ 175   β¬‡οΈ 886K
Dart 3 compatible
Maintenance Status: Good

A package exposing annotations for riverpod_generator

dart_mappable
πŸ‘ 455   β¬‡οΈ 327.2K
Dart 3 compatible
Maintenance Status: Good

Improved json serialization and data classes with full support for generics, inheritance, customization and more.

flutter_gen_runner
πŸ‘ 318   β¬‡οΈ 451.5K
Dart 3 compatible
Maintenance Status: Good

The Flutter code generator for your assets, fonts, colors, … β€” Get rid of all String-based APIs.

hive_generator
πŸ‘ 424   β¬‡οΈ 175.8K
Dart 3 compatible
Maintenance Status: Poor

Extension for Hive. Automatically generates TypeAdapters to store any class.

retrofit_generator
πŸ‘ 199   β¬‡οΈ 374.5K
Dart 3 compatible
Maintenance Status: Good

retrofit generator is an dio client generator using source_gen and inspired by Chopper and Retrofit.

drift_dev
πŸ‘ 68   β¬‡οΈ 513.4K
Dart 3 compatible
Maintenance Status: Good

Dev-dependency for users of drift. Contains the generator and development tools.

injectable_generator
πŸ‘ 133   β¬‡οΈ 431.5K
Dart 3 compatible
Maintenance Status: Good

Injectable is a convenient code generator for get_it. Inspired by Angular DI, Guice DI and inject.dart.

built_value_generator
πŸ‘ 148   β¬‡οΈ 281.5K
Dart 3 compatible
Maintenance Status: Good

Value types with builders, Dart classes as enums, and serialization. This library is the dev dependency.

mobx_codegen
πŸ‘ 301   β¬‡οΈ 54.1K
Dart 3 compatible
Maintenance Status: Good

Code generator for MobX that adds support for annotating your code with @observable, @computed, @action and also creating Store classes.

widgetbook_annotation
πŸ‘ 19   β¬‡οΈ 379.3K
Dart 3 compatible
Maintenance Status: Good

A package featuring the annotations used by widgetbook_generator.

copy_with_extension_gen
πŸ‘ 219   β¬‡οΈ 101.2K
Dart 3 compatible
Maintenance Status: Good

Automatically generating `copyWith` extensions code for classes with `@CopyWith()` annotation.

dart_json_mapper
πŸ‘ 279   β¬‡οΈ 2K
Dart 3 compatible
Maintenance Status: Good

This package allows programmers to annotate Dart objects in order to serialize / deserialize them from / to JSON.

graphql_codegen
πŸ‘ 151   β¬‡οΈ 132.2K
Dart 3 compatible
Maintenance Status: Good

Simple, opinionated, codegen library for GraphQL. It allows you to generate serializers and client helpers to easily call and parse your data.

widgetbook_generator
πŸ‘ 20   β¬‡οΈ 264K
Dart 3 compatible
Maintenance Status: Good

A package to automate setup and maintenance of the widgetbook package by using code generation.

protoc_plugin
πŸ‘ 96   β¬‡οΈ 156K
Dart 3 compatible
Maintenance Status: Good

A protobuf protoc compiler plugin used to generate Dart code.

jnigen
πŸ‘ 129   β¬‡οΈ 28.6K
Dart 3 compatible
Maintenance Status: Good

A Dart bindings generator for Java and Kotlin that uses JNI under the hood to interop with Java virtual machine.

auto_mappr
πŸ‘ 140   β¬‡οΈ 11.7K
Dart 3 compatible
Maintenance Status: Good

Code generation for mapping between different objects with ease.

flutter_asset_generator
πŸ‘ 111   β¬‡οΈ 1.5K
Dart 3 compatible
Maintenance Status: Average

Generates the resource file by scanning assets defined in the pubspec.yaml, imitation R file short name.

functional_data
πŸ‘ 19   β¬‡οΈ 110.8K
Dart 3 compatible
Maintenance Status: Poor

Annotations and helpers for lenses for code generated with the `function_data_generator` package.

sum_types
πŸ‘ 13   β¬‡οΈ 57.5K
Dart 3 compatible
Maintenance Status: Average

sum_types and sum_types_generator packages together define a code generator enabling sum-types in Dart.

stacked_generator
πŸ‘ 46   β¬‡οΈ 12.6K
Dart 3 compatible
Maintenance Status: Good

Stacked Generator is a package dedicated to reduce the boilerplate required to setup a stacked application

super_annotations
πŸ‘ 49   β¬‡οΈ 120
Dart 3 compatible
Maintenance Status: Good

Write your code generation functions naturally alongside your normal code. Define and use custom annotations in the same file or project.

pubspec_generator Card Image
pubspec_generator
πŸ‘ 45   β¬‡οΈ 858
Dart 3 compatible
Maintenance Status: Good

Code generator pubspec.yaml.g.dart from pubspec.yaml. Just import `pubspec_generator` and then run `dart run build_runner build`

macro_kit
πŸ‘ 45   β¬‡οΈ 455
Dart 3 compatible
Maintenance Status: Good

A development-time macro system for Dart that generates code instantly for fast iteration without build_runner.

ferry_generator
πŸ‘ 23   β¬‡οΈ 26.8K
Dart 3 compatible
Maintenance Status: Good

Generated types for Ferry GraphQL Client

json_model
πŸ‘ 44   β¬‡οΈ 641
Dart 3 compatible
Maintenance Status: Poor

Gernerating Dart model class from Json files with one command.

embed
πŸ‘ 34   β¬‡οΈ 10.8K
Dart 3 compatible
Maintenance Status: Good

Code generation for embedding arbitrary file content into Dart code.

index_generator
πŸ‘ 33   β¬‡οΈ 11.9K
Dart 3 compatible
Maintenance Status: Good

Automatically generate index / barrel / library files with all the export needed for your library.

isar_generator
πŸ‘ 38   β¬‡οΈ 998
Dart 3 compatible
Maintenance Status: Poor

Code generator for the Isar Database. Finds classes annotated with @Collection.

barrel_files
πŸ‘ 34   β¬‡οΈ 543
Dart 3 compatible
Maintenance Status: Good

Generate barrel files for Dart and Flutter packages with build_runner based on code annotations

dson_adapter
πŸ‘ 31   β¬‡οΈ 21
Dart 3 compatible
Maintenance Status: Poor

Convert JSON to Dart Class withless code generate(build_runner)

cached_build_runner
πŸ‘ 29   β¬‡οΈ 137
Dart 3 compatible
Maintenance Status: Poor

Optimizes the build_runner by caching generated codes for non changed .dart files

flutterfire_gen
πŸ‘ 28   β¬‡οΈ 290
Dart 3 compatible
Maintenance Status: Good

flutterfire_gen is a package for automatic code generation for Cloud Firestore. It supports efficient CRUD operations with type-safe interfaces and methods.

cached_annotation
πŸ‘ 23   β¬‡οΈ 4.9K
Dart 3 compatible
Maintenance Status: Good

Annotations for the Cached code-generator. This package does nothing without Cached.

modular_codegen
πŸ‘ 24   β¬‡οΈ 109
Dart 3 compatible
Maintenance Status: Poor

Code Generate for flutter_modular. Inject Automation. Annotation @Inject, @Param and @Data.

gql_build
πŸ‘ 15   β¬‡οΈ 10.6K
Dart 3 compatible
Maintenance Status: Good

Useful builders for your GraphQL SDL and documents. Based on package:gql_code_builder and package:build

gate_generator
πŸ‘ 22   β¬‡οΈ 57
Dart 3 compatible
Maintenance Status: Poor

Dependency Injection generator for your flutter/dart applications. This uses annotations and build_runner.

simple_json
πŸ‘ 21   β¬‡οΈ 98
Dart 3 compatible
Maintenance Status: Poor

Simple way to dynamically convert from and to JSON using build-time generators given a type.

data_class_plugin
πŸ‘ 18   β¬‡οΈ 3.5K
Dart 3 compatible
Maintenance Status: Good

A tool that uses Dart's Analyzer to generate code on-the-fly.

sqfentity_gen
πŸ‘ 19   β¬‡οΈ 1.7K
Dart 3 compatible
Maintenance Status: Average

SqfnEntity Model Generator. SQLite ORM for Flutter lets you build and execute SQL commands easily and quickly with the help of fluent methods similar to .Net Entity Framework.

realm_generator
πŸ‘ 4   β¬‡οΈ 18.1K
Dart 3 compatible
Maintenance Status: Good

Generates RealmObject classes from Realm data model classes. This package is part of the official Realm Flutter and Realm Dart SDKs.

morphy
πŸ‘ 18   β¬‡οΈ 40
Dart 3 compatible
Maintenance Status: Good

Provides a clean class definition with extra functionality including; copy with, json serializable, tostring, equals that supports inheritance and polymorphism

kiwi_generator
πŸ‘ 13   β¬‡οΈ 2.7K
Dart 3 compatible
Maintenance Status: Average

Generates dependency injection code using the kiwi package to reduce development time.

dogs_core
πŸ‘ 10   β¬‡οΈ 280
Dart 3 compatible
Maintenance Status: Good

universal object mapping and serialization library with a focus on dx.

data_serializer
πŸ‘ 3   β¬‡οΈ 5.4K
Dart 3 compatible
Maintenance Status: Good

Portable Dart package to handle data serialization/deserialization efficiently, including a dynamic BytesBuffer to read/write data.

dart_json_mapper_mobx
πŸ‘ 7   β¬‡οΈ 90
Dart 3 compatible
Maintenance Status: Poor

This is a dart-json-mapper complementary package provides support for MobX Stores to persist as JSON.

flutter_ast
πŸ‘ 7   β¬‡οΈ 16
Dart 3 compatible
Maintenance Status: Poor

A Pure Dart File to Ast Serializer/Deserializer.

chopper_built_value
πŸ‘ 6   β¬‡οΈ 671
Dart 3 compatible
Maintenance Status: Good

A built_value based Converter for Chopper.

borsh_annotation
πŸ‘ 1   β¬‡οΈ 6.6K
Dart 3 compatible
Maintenance Status: Average

Annotation used to make a Dart object borsh serializable.

json_to_dart
πŸ‘ 6   β¬‡οΈ 73
Dart 3 compatible
Maintenance Status: Poor

A library that generates Dart classes (parse and generator included) from a json string.

borsh
πŸ‘ 5   β¬‡οΈ 84
Dart 3 compatible
Maintenance Status: Good

Implementation of the borsh serialization scheme

dart_json_mapper_flutter
πŸ‘ 4   β¬‡οΈ 96
Dart 3 compatible
Maintenance Status: Poor

This is a dart-json-mapper complementary package provides support for https://github.com/flutter/flutter types in order to serialize / deserialize them from / to JSON.

json_model_gen
πŸ‘ 4   β¬‡οΈ 28
Dart 3 compatible
Maintenance Status: Good

A Dart tool to generate model classes from JSON with fromJson, toJson, copyWith, and equality overrides.

brick_build
πŸ‘ 1   β¬‡οΈ 3.6K
Dart 3 compatible
Maintenance Status: Good

Code generation library and interface for Brick components. Useful for creating serdes generators for adapters.

brick_offline_first_with_rest_build
πŸ‘ 1   β¬‡οΈ 2.5K
Dart 3 compatible
Maintenance Status: Good

Code generation library for the Brick Offline First Domain using REST

brick_sqlite_generators
πŸ‘ 0   β¬‡οΈ 3.6K
Dart 3 compatible
Maintenance Status: Good

Code generation library for the SQLite providers, models, and adapters in Brick

brick_json_generators
πŸ‘ 0   β¬‡οΈ 3.5K
Dart 3 compatible
Maintenance Status: Good

Code generation library for the JSON-like providers, models, and adapters in Brick

brick_offline_first_build
πŸ‘ 0   β¬‡οΈ 3.5K
Dart 3 compatible
Maintenance Status: Good

Code generation library for the Brick Offline First Domain

doc_widget_annotation
πŸ‘ 2   β¬‡οΈ 559
Dart 3 compatible
Maintenance Status: Poor

This is a simple package that contains annotations to generate code in doc_widget

envify_generator
πŸ‘ 2   β¬‡οΈ 134
Dart 3 compatible
Maintenance Status: Poor

Code generator for envify, a better tool to handle environment variables.

brick_rest_generators
πŸ‘ 0   β¬‡οΈ 2.6K
Dart 3 compatible
Maintenance Status: Good

Code generation library for the REST providers, models, and adapters in Brick

typed_json
πŸ‘ 2   β¬‡οΈ 15
Dart 3 compatible
Maintenance Status: Poor

A library intended to bring manual JSON serialization to the Dart projects of all scales.

flamingo_generator
πŸ‘ 1   β¬‡οΈ 102
Dart 3 compatible
Maintenance Status: Poor

Automatically generate code for converting flamingo JSON by annotating Dart classes.

flamingo_annotation
πŸ‘ 1   β¬‡οΈ 60
Dart 3 compatible
Maintenance Status: Poor

Automatically generate code for converting flamingo JSON by annotating Dart classes.

dart_json_mapper_fixnum
πŸ‘ 1   β¬‡οΈ 46
Dart 3 compatible
Maintenance Status: Poor

This is a dart-json-mapper complementary package provides support for https://pub.dev/packages/fixnum types in order to serialize / deserialize them from / to JSON.

dart_json_mapper_built
πŸ‘ 1   β¬‡οΈ 31
Dart 3 compatible
Maintenance Status: Poor

This is a dart-json-mapper complementary package provides support for https://pub.dev/packages/built_collection types in order to serialize / deserialize them from / to JSON.

simple_assets_generator
πŸ‘ 1   β¬‡οΈ 21
Dart 3 compatible
Maintenance Status: Poor

Assets generator package.

brick_graphql_generators
πŸ‘ 0   β¬‡οΈ 209
Dart 3 compatible
Maintenance Status: Good

Code generation library for the GraphQL providers, models, and adapters in Brick

carp_study_generator
πŸ‘ 0   β¬‡οΈ 179
Dart 3 compatible
Maintenance Status: Good

Utilities for managing CARP Mobile Sensing studies, including generating and uploading a study protocol, informed consent, translations, and messages.

brick_offline_first_with_graphql_build
πŸ‘ 0   β¬‡οΈ 158
Dart 3 compatible
Maintenance Status: Good

Code generation library for the Brick Offline First Domain using GraphQL

simple_auth_generator
πŸ‘ 0   β¬‡οΈ 42
Dart 3 compatible
Maintenance Status: Poor

simple_auth is an http client generator using source_gen and inspired from retrofit and chopper

gql_code_builder
πŸ‘ 5   β¬‡οΈ 223.3K

Maintenance Status: Good

Dart code builders taking *.graphql documents and SDL to build useful classes.

dataclass
πŸ‘ 62   β¬‡οΈ 62

Maintenance Status: Average

Code generation for immutable classes that has a simple syntax/API without compromising on the features.

data_class
πŸ‘ 60   β¬‡οΈ 34

Maintenance Status: Average

Experimental support for data classes in Dart using pkg:macros

json_to_model
πŸ‘ 46   β¬‡οΈ 300

Maintenance Status: Poor

Generate model class from Json file.

framy_annotation
πŸ‘ 28   β¬‡οΈ 59

Maintenance Status: Poor

Annotations for framy_generator. This package does nothing without framy_generator.

json_utilities
πŸ‘ 7   β¬‡οΈ 18

Maintenance Status: Poor

A collection of json utilities to enhance the experience of working with json based models.