Flutter Gems is a curated list of 6000+ useful Dart & Flutter packages that are categorized based on functionality.
Top Flutter Code Generator and Serialization (JSON) packages
Last updated: November 15, 2024
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.
freezed
Dart 3 compatible 👍 3.98K
Maintenance Status: Good
Code generation for immutable classes that has a simple syntax/API without compromising on the features.
json_serializable
Dart 3 compatible 👍 3.57K
Maintenance Status: Good
Automatically generate code for converting to and from JSON by annotating Dart classes.
flutter_gen
Dart 3 compatible 👍 1.47K
Maintenance Status: Good
The Flutter code generator for your assets, fonts, colors, … — Get rid of all String-based APIs.
json_annotation
Dart 3 compatible 👍 1.14K
Maintenance Status: Good
Classes and helper functions that support JSON code generation via the 'json_serializable' package.
pigeon
Dart 3 compatible 👍 1.04K
Maintenance Status: Good
Code generator tool to make communication between Flutter and the host platform type-safe and easier.
freezed_annotation
Dart 3 compatible 👍 446
Maintenance Status: Good
Annotations for the freezed code-generator. This package does nothing without freezed too.
riverpod_generator
Dart 3 compatible 👍 376
Maintenance Status: Good
A code generator for Riverpod. This both simplifies the syntax empowers it, such as allowing stateful hot-reload.
dart_mappable
Dart 3 compatible 👍 313
Maintenance Status: Good
Improved json serialization and data classes with full support for generics, inheritance, customization and more.
mobx_codegen
Dart 3 compatible 👍 292
Maintenance Status: Good
Code generator for MobX that adds support for annotating your code with @observable, @computed, @action and also creating Store classes.
ffigen
Dart 3 compatible 👍 280
Maintenance Status: Good
Generator for FFI bindings, using LibClang to parse C, Objective-C, and Swift files.
dart_json_mapper
Dart 3 compatible 👍 269
Maintenance Status: Good
This package allows programmers to annotate Dart objects in order to serialize / deserialize them from / to JSON.
functional_widget
Dart 3 compatible 👍 256
Maintenance Status: Good
A code generator that generates widget classes from their implementation as a function.
flutter_gen_runner
Dart 3 compatible 👍 238
Maintenance Status: Good
The Flutter code generator for your assets, fonts, colors, … — Get rid of all String-based APIs.
retrofit_generator
Dart 3 compatible 👍 162
Maintenance Status: Good
retrofit generator is an dio client generator using source_gen and inspired by Chopper and Retrofit.
source_gen
Dart 3 compatible 👍 155
Maintenance Status: Good
Source code generation builders and utilities for the Dart build system
built_value_generator
Dart 3 compatible 👍 139
Maintenance Status: Good
Value types with builders, Dart classes as enums, and serialization. This library is the dev dependency.
riverpod_annotation
Dart 3 compatible 👍 137
Maintenance Status: Good
A package exposing annotations for riverpod_generator
graphql_codegen
Dart 3 compatible 👍 126
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.
auto_mappr
Dart 3 compatible 👍 113
Maintenance Status: Good
Code generation for mapping between different objects with ease.
injectable_generator
Dart 3 compatible 👍 111
Maintenance Status: Good
Injectable is a convenient code generator for get_it. Inspired by Angular DI, Guice DI and inject.dart.
jnigen
Dart 3 compatible 👍 83
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
Dart 3 compatible 👍 69
Maintenance Status: Good
Generates the resource file by scanning assets defined in the pubspec.yaml, imitation R file short name.
dataclass
Dart 3 compatible 👍 59
Maintenance Status: Good
Code generation for immutable classes that has a simple syntax/API without compromising on the features.
drift_dev
Dart 3 compatible 👍 47
Maintenance Status: Good
Dev-dependency for users of drift. Contains the generator and development tools.
stacked_generator
Dart 3 compatible 👍 38
Maintenance Status: Good
Stacked Generator is a package dedicated to reduce the boilerplate required to setup a stacked application
super_annotations
Dart 3 compatible 👍 37
Maintenance Status: Good
Write your code generation functions naturally alongside your normal code. Define and use custom annotations in the same file or project.
embed
Dart 3 compatible 👍 28
Maintenance Status: Good
Code generation for embedding arbitrary file content into Dart code.
ferry_generator
Dart 3 compatible 👍 23
Maintenance Status: Good
Generated types for Ferry GraphQL Client
cached_annotation
Dart 3 compatible 👍 22
Maintenance Status: Good
Annotations for the Cached code-generator. This package does nothing without Cached.
sqfentity_gen
Dart 3 compatible 👍 19
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.
functional_data
Dart 3 compatible 👍 17
Maintenance Status: Good
Annotations and helpers for lenses for code generated with the 'function_data_generator' package.
gql_build
Dart 3 compatible 👍 15
Maintenance Status: Good
Useful builders for your GraphQL SDL and documents. Based on package:gql_code_builder and package:build
widgetbook_generator
Dart 3 compatible 👍 13
Maintenance Status: Good
A package to automate setup and maintenance of the widgetbook package by using code generation.
widgetbook_annotation
Dart 3 compatible 👍 13
Maintenance Status: Good
A package featuring the annotations used by widgetbook_generator.
sum_types
Dart 3 compatible 👍 13
Maintenance Status: Good
sum_types and sum_types_generator packages together define a code generator enabling sum-types in Dart.
morphy
Dart 3 compatible 👍 12
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
Dart 3 compatible 👍 12
Maintenance Status: Good
Generates dependency injection code using the kiwi package to reduce development time.
dogs_core
Dart 3 compatible 👍 6
Maintenance Status: Good
universal object mapping and serialization library with a focus on dx.
chopper_built_value
Dart 3 compatible 👍 6
Maintenance Status: Good
A built_value based Converter for Chopper.
gql_code_builder
Dart 3 compatible 👍 5
Maintenance Status: Good
Dart code builders taking *.graphql documents and SDL to build useful classes.
realm_generator
Dart 3 compatible 👍 4
Maintenance Status: Good
Generates RealmObject classes from Realm data model classes. This package is part of the official Realm Flutter and Realm Dart SDKs.
brick_build
Dart 3 compatible 👍 1
Maintenance Status: Good
Code generation library and interface for Brick components. Useful for creating serdes generators for adapters.
carp_study_generator
Dart 3 compatible 👍 0
Maintenance Status: Good
Utilities for managing CARP Mobile Sensing studies, including generating and uploading a study protocol, informed consent, translations, and messages.
brick_sqlite_generators
Dart 3 compatible 👍 0
Maintenance Status: Good
Code generation library for the SQLite providers, models, and adapters in Brick
brick_rest_generators
Dart 3 compatible 👍 0
Maintenance Status: Good
Code generation library for the REST providers, models, and adapters in Brick
brick_offline_first_with_graphql_build
Dart 3 compatible 👍 0
Maintenance Status: Good
Code generation library for the Brick Offline First Domain using GraphQL
brick_offline_first_build
Dart 3 compatible 👍 0
Maintenance Status: Good
Code generation library for the Brick Offline First Domain
brick_json_generators
Dart 3 compatible 👍 0
Maintenance Status: Good
Code generation library for the JSON-like providers, models, and adapters in Brick
brick_graphql_generators
Dart 3 compatible 👍 0
Maintenance Status: Good
Code generation library for the GraphQL providers, models, and adapters in Brick
hive_generator
Dart 3 compatible 👍 366
Maintenance Status: Average
Extension for Hive. Automatically generates TypeAdapters to store any class.
copy_with_extension_gen
Dart 3 compatible 👍 188
Maintenance Status: Average
Automatically generating 'copyWith' extensions code for classes with '@CopyWith()' annotation.
protoc_plugin
Dart 3 compatible 👍 84
Maintenance Status: Average
A protobuf protoc compiler plugin used to generate Dart code.
pubspec_generator
Dart 3 compatible 👍 36
Maintenance Status: Average
Code generator pubspec.yaml.g.dart from pubspec.yaml. Just import `pubspec_generator` and then run `dart run build_runner build`
isar_generator
Dart 3 compatible 👍 32
Maintenance Status: Average
Code generator for the Isar Database. Finds classes annotated with @Collection.
dson_adapter
Dart 3 compatible 👍 30
Maintenance Status: Average
Convert JSON to Dart Class withless code generate(build_runner)
gate_generator
Dart 3 compatible 👍 21
Maintenance Status: Average
Dependency Injection generator for your flutter/dart applications. This uses annotations and build_runner.
flutter_ast
Dart 3 compatible 👍 6
Maintenance Status: Average
A Pure Dart File to Ast Serializer/Deserializer.
borsh
Dart 3 compatible 👍 4
Maintenance Status: Average
Implementation of the borsh serialization scheme
typed_json
Dart 3 compatible 👍 2
Maintenance Status: Average
A library intended to bring manual JSON serialization to the Dart projects of all scales.
envify_generator
Dart 3 compatible 👍 2
Maintenance Status: Average
Code generator for envify, a better tool to handle environment variables.
simple_assets_generator
Dart 3 compatible 👍 1
Maintenance Status: Average
Assets generator package.
flamingo_generator
Dart 3 compatible 👍 1
Maintenance Status: Average
Automatically generate code for converting flamingo JSON by annotating Dart classes.
flamingo_annotation
Dart 3 compatible 👍 1
Maintenance Status: Average
Automatically generate code for converting flamingo JSON by annotating Dart classes.
brick_offline_first_with_rest_build
Dart 3 compatible 👍 1
Maintenance Status: Average
Code generation library for the Brick Offline First Domain using REST
borsh_annotation
Dart 3 compatible 👍 1
Maintenance Status: Average
Annotation used to make a Dart object borsh serializable.
json_model
Dart 3 compatible 👍 43
Maintenance Status: Poor
Gernerating Dart model class from Json files with one command.
modular_codegen
Dart 3 compatible 👍 24
Maintenance Status: Poor
Code Generate for flutter_modular. Inject Automation. Annotation @Inject, @Param and @Data.
freezer
Dart 3 compatible 👍 24
Maintenance Status: Poor
Provides the easiest and most productive automatic generation of model objects from JSON files.
simple_json
Dart 3 compatible 👍 21
Maintenance Status: Poor
Simple way to dynamically convert from and to JSON using build-time generators given a type.
dart_json_mapper_mobx
Dart 3 compatible 👍 7
Maintenance Status: Poor
This is a dart-json-mapper complementary package provides support for MobX Stores to persist as JSON.
json_to_dart
Dart 3 compatible 👍 5
Maintenance Status: Poor
A library that generates Dart classes (parse and generator included) from a json string.
dart_json_mapper_flutter
Dart 3 compatible 👍 4
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.
doc_widget_annotation
Dart 3 compatible 👍 2
Maintenance Status: Poor
This is a simple package that contains annotations to generate code in doc_widget
dart_json_mapper_fixnum
Dart 3 compatible 👍 1
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.
dart_json_mapper_built
Dart 3 compatible 👍 1
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.
simple_auth_generator
Dart 3 compatible 👍 0
Maintenance Status: Poor
simple_auth is an http client generator using source_gen and inspired from retrofit and chopper
framy_annotation
👍 28
Maintenance Status: Poor
Annotations for framy_generator. This package does nothing without framy_generator.
json_utilities
👍 7
Maintenance Status: Poor
A collection of json utilities to enhance the experience of working with json based models.