Skip to content

Improve Handling of Explicit null in Serialization #15

@DmitrySboychakov

Description

@DmitrySboychakov

Problem Statement

Dart’s current serialization approach struggles with APIs that distinguish between null as an explicit value and the absence of a value (undefined). This limitation affects interoperability with APIs that require null to be treated as a meaningful value rather than as a missing field.

Currently, Dart developers must choose how to handle nullable fields globally or per object during de/serialization, leading to inconsistencies, extra boilerplate, and potential data loss or misinterpretation when integrating with external APIs.

Expected Behavior

It would be great to have more flexible serialization mechanism that allows developers to:

  1. Explicitly differentiate null from missing fields in JSON and other serialized formats.
  2. Define handling strategies per field, object, or globally, rather than relying on a single approach across an entire project.
  3. Ensure better interoperability with APIs that depend on null as a valid data state.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions