CustomJsonSerializable class
Custom JsonSerializable class that uses custom converters to parse JSON objects consistently and robustly.
Constructors
- CustomJsonSerializable({bool? anyMap, bool? checked, String? constructor, bool? createFieldMap, bool? createJsonKeys, bool? createFactory, bool? createToJson = false, bool? disallowUnrecognizedKeys, bool? explicitToJson = true, FieldRename? fieldRename, bool? ignoreUnannotated, bool? includeIfNull, bool? genericArgumentFactories, bool? createPerFieldToJson})
-
const
Properties
- anyMap → bool?
-
If
true, Map types are not assumed to be Map<String, dynamic>– which is the default type of Map instances return by JSON decode indart:convert.finalinherited - checked → bool?
-
If
true, generatedfromJsonfunctions include extra checks to validate proper deserialization of types.finalinherited - constructor → String?
-
Specifies a named constructor to target when creating the
fromJsonfunction.finalinherited -
converters
→ List<
JsonConverter> ? -
A list of
JsonConverterto apply to this class.finalinherited - createFactory → bool?
-
If
true(the default), a private, static_$ExampleFromJsonmethod is created in the generated part file.finalinherited - createFieldMap → bool?
-
If
true(defaults to false), a private, static_$ExampleJsonMetaconstant is created in the generated part file.finalinherited - createJsonKeys → bool?
-
If
true(defaults to false), a private class_$ExampleJsonKeysclass is created in the generated part file.finalinherited - createJsonSchema → bool?
-
If
true(defaults to false), a top-level constant_$ExampleJsonSchemawill be created in the generated part file.finalinherited - createPerFieldToJson → bool?
-
If
true(defaults to false), a private, static_$ExamplePerFieldToJsonabstract class will be generated in the part file.finalinherited - createToJson → bool?
-
If
true(the default), A top-level function is created that you can reference from your class.finalinherited - dateTimeUtc → bool?
-
Whether the generator should use UTC time for DateTime fields.
finalinherited
- disallowUnrecognizedKeys → bool?
-
If
false(the default), then the generatedFromJsonfunction will ignore unrecognized keys in the provided JSON Map.finalinherited - explicitToJson → bool?
-
If
true, generatedtoJsonmethods will explicitly calltoJsonon nested objects.finalinherited - fieldRename → FieldRename?
-
Defines the automatic naming strategy when converting class field names
into JSON map keys.
finalinherited
- genericArgumentFactories → bool?
-
When
trueon classes with type parameters (generic types), extra "helper" parameters will be generated forfromJsonand/ortoJsonto support serializing values of those types.finalinherited - hashCode → int
-
The hash code for this object.
no setterinherited
- ignoreUnannotated → bool?
-
When
true, only fields annotated withJsonKeywill have code generated.finalinherited - includeIfNull → bool?
-
Whether the generator should include fields with
nullvalues in the serialized output.finalinherited - 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
-
toJson(
) → Map< String, dynamic> -
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
withDefaults(
) → JsonSerializable -
Returns a new
JsonSerializableinstance with fields equal to the corresponding values inthis, if notnull.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
-
defaultConverters
→ const List<
JsonConverter> - Default converters used by CustomJsonSerializable.