SelfCodable<T extends SelfEncodable> class abstract

A default Codable implementation for SelfEncodable types.

This should be used as the base class for creating a Codable implementation for an SelfEncodable type. Only the decode method needs to be implemented, as the encode method has a default implementation.

class PersonCodable extends SelfCodable<Person> {
  const PersonCodable();

  @override
  Person decode(Decoder decoder) {
    /* ... */
  }
}
Implemented types

Constructors

SelfCodable.new()
const
SelfCodable.fromHandler(T decode(Decoder decoder))
Creates a SelfCodable from a handler function.
factory

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

decode(Decoder decoder) → T
Decodes a value of type T using the decoder.
inherited
encode(T value, Encoder encoder) → void
Encodes the value using the encoder.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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