JsonConverter<T, S> class abstract

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 {
  final Value property;
}

or on a property:

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

Or finally, passed to the @JsonSerializable annotation:

@JsonSerializable(converters: [MyJsonConverter()])
class Example {
  final Value property;
}

Constructors

JsonConverter()
const

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

fromJson(S json) → T
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent 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