addDecoder<T> static method

bool addDecoder<T>(
  1. Decoder<T> decoder
)

Adds or updates a decoder function for type T. Returns true if the decoder was added.

Note: Decoders for the following types can not be added or updated.

  • bool, double, int, Null,num,Symbol,Type,
  • dynamic, List, Set, Map,
  • UnknownType.

Implementation

static bool addDecoder<T>(Decoder<T> decoder) {
  if (isBuiltIn(T) || T == UnknownType) return false;
  // Adding Decoder function.
  _decoders[T] = decoder;
  return true;
}