JsonTypeConverter2<D, S, J> mixin

A mixin for TypeConverters that should also apply to drift's builtin JSON serialization of data classes.

Unlike the old JsonTypeConverter mixin, this more general mixin allows using a different type when serializing to JSON (J) than the type used in SQL (S). For the cases where the JSON serialization and the mapping to SQL use the same types, it may be more convenient to mix-in JsonTypeConverter instead.

Superclass Constraints
Mixin Applications

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(J json) → D
Map a value from json to something understood by the data class.
fromSql(S fromDb) → D
Maps a column from the database back to Dart.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson(D value) → J
Map a value from the Data class to json.
toSql(D value) → S
Map a value from an object in Dart into something that will be understood by the database.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

asNullable<D, S extends Object, J extends Object>(JsonTypeConverter2<D, S, J> inner) JsonTypeConverter2<D?, S?, J?>
Wraps an inner type converter that only considers non-nullable values as a type converter that handles null values too.