DraftModeStorageSerializer<T> class

Minimal helper for turning JSON objects into strongly typed models.

Constructors

DraftModeStorageSerializer({required T fromJson(Map<String, dynamic>), required Map<String, dynamic> toJson(T)})

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

decode(String? jsonString) → T?
Parses jsonString and invokes fromJson when the payload is a JSON object. Returns null for blank payloads and throws a FormatException when the input is not a JSON object or when parsing fails.
decodeList(String? jsonString, {List<String>? nodeRoute}) List<T>
Parses jsonString and invokes fromJson for every entry in the payload when the input is a JSON array of objects. When nodeRoute is provided the decoded payload must be a JSON object and its nested value is resolved by following the segments in nodeRoute. Throws a FormatException when the resulting payload is not a JSON array, when an entry is not a JSON object, or when parsing fails.
encode(T entity) String
encodeList(Iterable<T> entities) String
Serializes entities into a JSON array string.
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