encodeObject<T> method

  1. @override
void encodeObject<T>(
  1. String key,
  2. T value, {
  3. int? id,
  4. Encodable<T>? using,
})
override

Encodes an object of type T for the given key or id.

This tries to encode the object using one of the following ways:

  1. If the using parameter is provided, it forwards the encoding to the provided Encodable implementation.
  2. If the object is a SelfEncodable, it calls SelfEncodable.encode on the object.
  3. If the object is a supported primitive value, it encodes it as such.
  4. If none of the above applies, an error is thrown.

This should only be called if the format returned true from canEncodeCustom

Implementation

@override
void encodeObject<T>(String key, T value, {int? id, Encodable<T>? using}) {
  _parent._writeObjectKey(key);
  _parent.encodeObject<T>(value, using: using);
}