JsonConverter<T, S> class Null safety

Implement this class to provide custom converters for a specific Type.

T is the data type you'd like to convert to and from.

S is the type of the value stored in JSON. It must be a valid JSON type such as String, int, or Map<String, dynamic>.

JsonConverters can be placed either on the class:

class MyJsonConverter extends JsonConverter<Value, JSON> {
  // TODO
}

@JsonSerializable()
@MyJsonConverter()
class Example {}

or on a property:

@JsonSerializable()
@MyJsonConverter()
class Example {
  @MyJsonConverter()
  final Value property;
}

Or finally, passed to the annotation:

@JsonSerializable(converters: [MyJsonConverter()])
class Example {}

Constructors

JsonConverter()
const

Properties

hashCode int
The hash code for this object.
read-onlyinherited
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited

Methods

fromJson(S json) → T
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
toJson(T object) → S
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited