Skip to content
pubscout

json_serializable_immutable_collections

1.1.3, released 10 months ago by demoda.app

Extends json_serializable to support immutable collections like BuiltList and KtList.

$ flutter pub add json_serializable_immutable_collections
Source repository

What it does

It adds support for additional immutable collection types, including BuiltList, BuiltSet, BuiltMap, KtList, KtSet, and KtMap, when using json_serializable for code generation.

AI-written summary of version 1.1.3, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You use json_serializable and need to serialize BuiltValue collections
  • You use json_serializable and need to serialize Kt collections

Skip it when

  • You do not use code generation or json_serializable
  • You only need standard Dart collections or standard json_serializable supported types

Strengths

  • Enables seamless JSON serialization for immutable collections
  • Integrates directly with the json_serializable ecosystem

Weaknesses

  • Requires specific build.yaml configuration to avoid builder conflicts
  • Unofficial package relying on json_serializable internals

Setup

Kind
Pure Dart
Effort
Medium
Code generation
Yes (build_runner)
Direct dependencies
8

Add to dev_dependencies and configure build.yaml to prevent conflicts with the standard json_serializable builder.

dependencies:
  dev_dependencies:
    json_serializable_immutable_collections: <current_version>

Alternatives

Packages that do the same job and could replace json_serializable_immutable_collections.

  • built_value

    Provides its own immutable value types and built-in serialization solution instead of relying on json_serializable.

Works with

Packages commonly used together with json_serializable_immutable_collections: ones it builds on, ones built on it, and its own family.