StandardJsonPlugin class
Switches to "standard" JSON format.
The default serialization format is more powerful, with better performance and support for more collection types. But, you may need to interact with other systems that use simple map-based JSON. If so, use SerializersBuilder.addPlugin to install this plugin.
When using this plugin you may wish to also install
Iso8601DateTimeSerializer
which switches serialization of DateTime
from microseconds since epoch to ISO 8601 format.
- Implemented types
Constructors
-
StandardJsonPlugin({String discriminator = r'$', String valueKey = '', Iterable<
Type> ? typesToLeaveAsList})
Properties
- discriminator → String
-
The field used to specify the value type if needed. Defaults to
$
.final - hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
typesToLeaveAsList
→ BuiltSet<
Type> -
The types to leave as a list when converting into json.
final
- valueKey → String
-
The key used when there is just a single value, for example if serializing
an
int
.final
Methods
-
afterDeserialize(
Object? object, FullType specifiedType) → Object? -
override
-
afterSerialize(
Object? object, FullType specifiedType) → Object? -
override
-
beforeDeserialize(
Object? object, FullType specifiedType) → Object? -
override
-
beforeSerialize(
Object? object, FullType specifiedType) → Object? -
override
-
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