JsonKey class Null safety

Annotation to use on column getters inside of a Table to define the name of the column in the json used by DataClass.toJson.

Example:

class Users extends Table {
  IntColumn get id => integer().autoIncrement()();
  @JsonKey('user_name')
  TextColumn get name => text().nullable()();
}

When calling DataClass.toJson on a User object, the output will be a map with the keys "id" and "user_name". The output would be "id" and "name" if the JsonKey annotation was omitted.

Constructors

JsonKey(String key)
An annotation to tell drift how the name of a column should appear in generated json. See the documentation for JsonKey for details.
const

Properties

hashCode int
The hash code for this object. [...]
read-only, inherited
key String
The key in the json map to use for this Column. See the documentation for JsonKey for details.
final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

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

Operators

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