CustomDataType<T extends Object?> class abstract interface Schema definition Custom data types

Interface to be implemented by custom types that can be stored in a Row for automatic (de)-serialization.

Subclasses must:

  • specify a concrete T that will be the serialized representation type. As one of:
    • String
    • Uint8List
    • bool
    • int
    • double
    • DateTime
  • have a fromDatabase(T value) constructor.

If a subclass implements Comparable then the encoded values returned by toDatabase must also be comparable and have the same ordering!

Tip

Custom types are not required to be immutable but using an immutable type is recommended. The analyzer can help with you this if you use the @immutable annotation from package:meta.

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

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDatabase() → T
toString() String
A string representation of this object.
inherited

Operators

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