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
jsonStringand invokesfromJsonwhen the payload is a JSON object. Returnsnullfor 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
jsonStringand invokesfromJsonfor every entry in the payload when the input is a JSON array of objects. WhennodeRouteis provided the decoded payload must be a JSON object and its nested value is resolved by following the segments innodeRoute. 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
entitiesinto 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