SerializationFeature enum
Feature flags that influence serialization behavior in JetLeaf.
These options control how values, structures, and formatting are handled when converting Dart objects into JSON output.
Example
final mapper = ObjectMapper()
..enable(SerializationFeature.INDENT_OUTPUT)
..disable(SerializationFeature.WRITE_NULL_MAP_VALUES);
Notes
- Features are toggled via
ObjectMapper.enable/ObjectMapper.disable. - Default configuration is optimized for correctness and minimal output size.
See also
Values
- FAIL_ON_EMPTY → const SerializationFeature
-
Fails serialization when an empty object (with no writable properties) is encountered. Useful for strict schema validation.
- WRITE_DATES_AS_TIMESTAMPS → const SerializationFeature
-
Serializes date and time values as numeric timestamps instead of ISO-8601 strings.
When enabled,
DateTime(2025, 10, 28)→1730073600000. - WRITE_NULL_MAP_VALUES → const SerializationFeature
-
Determines whether
nullentries in maps or fields should be written to the output JSON.true: writes"key": nullfalse: omits the key entirely
- INDENT_OUTPUT → const SerializationFeature
-
Enables human-readable, indented JSON output with line breaks.
Useful for debugging, logging, or pretty-printed configuration files.
- ORDER_MAP_ENTRIES_BY_KEYS → const SerializationFeature
-
Orders map entries by their keys in lexicographic order before writing.
Ensures deterministic output for schema comparison and caching.
- WRAP_ROOT_VALUE → const SerializationFeature
-
Wraps the root value within an additional object named after its type.
Example:
{ "User": { "id": 1, "name": "Alice" } }
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- index → int
-
A numeric identifier for the enumerated value.
no setterinherited
- name → String
-
Available on Enum, provided by the EnumName extension
The name of the enum value.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
-
values
→ const List<
SerializationFeature> - A constant List of the values in this enum, in order of their declaration.