models/util/json_value library
Functions
-
convertJsonValue<
T> (Object? raw) → T? -
Converts a raw JSON value to
T, or returns null when that would lose or invent data, e.g."7"to7. -
decodeJsonText(
Object? raw) → Object? -
Decodes
rawwhen it's JSON sent as text, e.g.'{"a": 1}'to a map; anything else comes back unchanged. -
toJsonValue(
Object? value) → Object? -
Converts
valueto plain JSON: nested models become maps, dates ISO text and enums their name.