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

Discord Medium LinkedIn Twitter

Top Flutter Code Generator and Serialization (JSON) packages

Last updated: January 26, 2025

Code generation is a technique for automatically generating code based on certain input data or rules. In Flutter, code generation is used for a variety of purposes, such as generating code for working with JSON data, generating code for working with databases, and generating code for working with web services. Code generation can make it easier to write and maintain code, as it can automate repetitive tasks and reduce the amount of manual coding that is required.

JSON serialization is the process of converting data from a structured format, such as a JSON object, into a format that can be easily stored or transmitted. In Flutter, JSON serialization is often used for working with data that comes from web services or other external sources. The Flutter framework provides built-in support for serializing and deserializing JSON data, making it easy to work with JSON in your Flutter applications. There are various packages which provides essential tools for encoding Dart objects into JSON and decoding JSON back into Dart objects as well as parsing JSON. This capability proves crucial when fetching data from APIs, managing configuration files, or persisting local app state.

Annotations are a way of adding metadata or additional information to your code. In Flutter, annotations are typically used to provide additional information about the types of data that are used in your code, such as the types of objects that are returned by a function or the types of parameters that are accepted by a method. Annotations can be useful for providing additional context to your code, and can also be used by tools such as IDEs to provide better code completion and error checking.

The complete list of Dart and Flutter Code Generation, JSON Serialization and Annotation packages is provided below.


json_annotation
👍 1.17K   ⬇️ 4.6M
Dart 3 compatible
Maintenance Status: Good

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

json_serializable
👍 3.67K   ⬇️ 1.6M
Dart 3 compatible
Maintenance Status: Good

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

freezed
👍 4.09K   ⬇️ 1.2M
Dart 3 compatible
Maintenance Status: Good

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

freezed_annotation
👍 468   ⬇️ 2.6M
Dart 3 compatible
Maintenance Status: Good

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

source_gen
👍 164   ⬇️ 2.6M
Dart 3 compatible
Maintenance Status: Good

Source code generation builders and utilities for the Dart build system

source_helper
👍 18   ⬇️ 1.6M
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.54K   ⬇️ 63K
Dart 3 compatible
Maintenance Status: Good

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

pigeon
👍 1.08K   ⬇️ 197.3K
Dart 3 compatible
Maintenance Status: Good

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

asn1lib
👍 20   ⬇️ 859.5K
Dart 3 compatible
Maintenance Status: Good

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

functional_data
👍 17   ⬇️ 846.9K
Dart 3 compatible
Maintenance Status: Good

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

sum_types
👍 13   ⬇️ 831.4K
Dart 3 compatible
Maintenance Status: Good

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

ffigen
👍 287   ⬇️ 500.7K
Dart 3 compatible
Maintenance Status: Good

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

riverpod_generator
👍 387   ⬇️ 318K
Dart 3 compatible
Maintenance Status: Good

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

hive_generator
👍 376   ⬇️ 240.9K
Dart 3 compatible
Maintenance Status: Average

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

flutter_gen_runner
👍 254   ⬇️ 242.7K
Dart 3 compatible
Maintenance Status: Good

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

riverpod_annotation
👍 145   ⬇️ 322.6K
Dart 3 compatible
Maintenance Status: Good

A package exposing annotations for riverpod_generator

dart_mappable
👍 339   ⬇️ 137.6K
Dart 3 compatible
Maintenance Status: Good

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

built_value_generator
👍 142   ⬇️ 244.8K
Dart 3 compatible
Maintenance Status: Good

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

retrofit_generator
👍 164   ⬇️ 217.5K
Dart 3 compatible
Maintenance Status: Good

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

injectable_generator
👍 116   ⬇️ 234.4K
Dart 3 compatible
Maintenance Status: Good

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

mobx_codegen
👍 297   ⬇️ 65.5K
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.

dart_json_mapper
👍 272   ⬇️ 2.6K
Dart 3 compatible
Maintenance Status: Good

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

functional_widget
👍 256   ⬇️ 3.4K
Dart 3 compatible
Maintenance Status: Average

A code generator that generates widget classes from their implementation as a function.

protoc_plugin
👍 85   ⬇️ 145K
Dart 3 compatible
Maintenance Status: Average

A protobuf protoc compiler plugin used to generate Dart code.

copy_with_extension_gen
👍 189   ⬇️ 54.5K
Dart 3 compatible
Maintenance Status: Good

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

drift_dev
👍 49   ⬇️ 143.2K
Dart 3 compatible
Maintenance Status: Good

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

graphql_codegen
👍 131   ⬇️ 49.7K
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_annotation
👍 14   ⬇️ 93.2K
Dart 3 compatible
Maintenance Status: Good

A package featuring the annotations used by widgetbook_generator.

auto_mappr
👍 117   ⬇️ 6.7K
Dart 3 compatible
Maintenance Status: Good

Code generation for mapping between different objects with ease.

widgetbook_generator
👍 13   ⬇️ 77.4K
Dart 3 compatible
Maintenance Status: Good

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

jnigen
👍 93   ⬇️ 1.7K
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.

flutter_asset_generator
👍 72   ⬇️ 2.1K
Dart 3 compatible
Maintenance Status: Good

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

gql_code_builder
👍 5   ⬇️ 55K
Dart 3 compatible
Maintenance Status: Good

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

dataclass
👍 62   ⬇️ 51
Dart 3 compatible
Maintenance Status: Good

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

realm_generator
👍 4   ⬇️ 43.4K
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.

data_class
👍 54   ⬇️ 106
Dart 3 compatible
Maintenance Status: Good

Experimental support for data classes in Dart using pkg:macros

stacked_generator
👍 38   ⬇️ 10.5K
Dart 3 compatible
Maintenance Status: Good

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

json_model
👍 43   ⬇️ 4K
Dart 3 compatible
Maintenance Status: Poor

Gernerating Dart model class from Json files with one command.

super_annotations
👍 39   ⬇️ 852
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
👍 39   ⬇️ 642
Dart 3 compatible
Maintenance Status: Average

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

kiwi_generator
👍 12   ⬇️ 22.6K
Dart 3 compatible
Maintenance Status: Good

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

ferry_generator
👍 23   ⬇️ 11.9K
Dart 3 compatible
Maintenance Status: Good

Generated types for Ferry GraphQL Client

isar_generator
👍 32   ⬇️ 2.5K
Dart 3 compatible
Maintenance Status: Average

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

index_generator
👍 25   ⬇️ 5.6K
Dart 3 compatible
Maintenance Status: Good

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

embed
👍 28   ⬇️ 2.9K
Dart 3 compatible
Maintenance Status: Good

Code generation for embedding arbitrary file content into Dart code.

dson_adapter
👍 30   ⬇️ 4
Dart 3 compatible
Maintenance Status: Average

Convert JSON to Dart Class withless code generate(build_runner)

barrel_files
👍 26   ⬇️ 2.3K
Dart 3 compatible
Maintenance Status: Average

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

cached_annotation
👍 22   ⬇️ 4.7K
Dart 3 compatible
Maintenance Status: Good

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

flutterfire_gen
👍 27   ⬇️ 81
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.

modular_codegen
👍 24   ⬇️ 243
Dart 3 compatible
Maintenance Status: Poor

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

data_class_plugin
👍 18   ⬇️ 4.8K
Dart 3 compatible
Maintenance Status: Good

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

gate_generator
👍 21   ⬇️ 100
Dart 3 compatible
Maintenance Status: Average

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

simple_json
👍 21   ⬇️ 80
Dart 3 compatible
Maintenance Status: Poor

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

sqfentity_gen
👍 19   ⬇️ 1.5K
Dart 3 compatible
Maintenance Status: Good

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.

morphy
👍 16   ⬇️ 428
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

data_serializer
👍 3   ⬇️ 11K
Dart 3 compatible
Maintenance Status: Good

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

gql_build
👍 15   ⬇️ 730
Dart 3 compatible
Maintenance Status: Average

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

dogs_core
👍 8   ⬇️ 514
Dart 3 compatible
Maintenance Status: Good

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

dart_json_mapper_mobx
👍 7   ⬇️ 101
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   ⬇️ 8
Dart 3 compatible
Maintenance Status: Average

A Pure Dart File to Ast Serializer/Deserializer.

chopper_built_value
👍 6   ⬇️ 773
Dart 3 compatible
Maintenance Status: Good

A built_value based Converter for Chopper.

doc_widget_annotation
👍 2   ⬇️ 3.2K
Dart 3 compatible
Maintenance Status: Poor

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

json_to_dart
👍 5   ⬇️ 44
Dart 3 compatible
Maintenance Status: Poor

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

borsh
👍 5   ⬇️ 23
Dart 3 compatible
Maintenance Status: Average

Implementation of the borsh serialization scheme

dart_json_mapper_flutter
👍 4   ⬇️ 228
Dart 3 compatible
Maintenance Status: Poor

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

brick_build
👍 1   ⬇️ 2.6K
Dart 3 compatible
Maintenance Status: Good

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

envify_generator
👍 2   ⬇️ 358
Dart 3 compatible
Maintenance Status: Average

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

brick_offline_first_with_rest_build
👍 1   ⬇️ 995
Dart 3 compatible
Maintenance Status: Good

Code generation library for the Brick Offline First Domain using REST

brick_offline_first_build
👍 0   ⬇️ 1.8K
Dart 3 compatible
Maintenance Status: Good

Code generation library for the Brick Offline First Domain

brick_sqlite_generators
👍 0   ⬇️ 1.8K
Dart 3 compatible
Maintenance Status: Good

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

typed_json
👍 2   ⬇️ 27
Dart 3 compatible
Maintenance Status: Poor

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

brick_json_generators
👍 0   ⬇️ 1.4K
Dart 3 compatible
Maintenance Status: Good

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

brick_rest_generators
👍 0   ⬇️ 1.1K
Dart 3 compatible
Maintenance Status: Good

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

simple_assets_generator
👍 1   ⬇️ 74
Dart 3 compatible
Maintenance Status: Average

Assets generator package.

dart_json_mapper_built
👍 1   ⬇️ 54
Dart 3 compatible
Maintenance Status: Poor

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

dart_json_mapper_fixnum
👍 1   ⬇️ 45
Dart 3 compatible
Maintenance Status: Poor

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

flamingo_generator
👍 1   ⬇️ 37
Dart 3 compatible
Maintenance Status: Average

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

flamingo_annotation
👍 1   ⬇️ 33
Dart 3 compatible
Maintenance Status: Average

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

borsh_annotation
👍 1   ⬇️ 9
Dart 3 compatible
Maintenance Status: Average

Annotation used to make a Dart object borsh serializable.

brick_graphql_generators
👍 0   ⬇️ 377
Dart 3 compatible
Maintenance Status: Good

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

brick_offline_first_with_graphql_build
👍 0   ⬇️ 248
Dart 3 compatible
Maintenance Status: Good

Code generation library for the Brick Offline First Domain using GraphQL

carp_study_generator
👍 0   ⬇️ 123
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.

simple_auth_generator
👍 0   ⬇️ 65
Dart 3 compatible
Maintenance Status: Poor

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

json_to_model
👍 46   ⬇️ 119

Maintenance Status: Poor

Generate model class from Json file.

framy_annotation
👍 28   ⬇️ 12

Maintenance Status: Poor

Annotations for framy_generator. This package does nothing without framy_generator.

json_utilities
👍 7   ⬇️ 45

Maintenance Status: Poor

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