MultiBinaryType<T, U> constructor

const MultiBinaryType<T, U>({
  1. Map<U, BinaryType<T>> subtypes = const {},
  2. BinaryType<T> getSubtype(
    1. U
    ) = _getSubtype,
})

A BinaryType that selects one of multiple other BinaryTypes to serialize an object based on fields common to all possible types.

{@template prelude} The set of fields common to all possible types that can be used to identify the specific type to use is knows as the prelude. It may be a single value (e.g String type) or multiple values in a record (e.g (int protocolVersion, String type)).

The prelude type must correctly implement Object.== and Object.hashCode.

Implementation

const MultiBinaryType({
  this.subtypes = const {},
  this.getSubtype = _getSubtype,
});