PayloadVersionRegistry<T> class

Registry of version-specific payload decoders for a single durable DTO type.

Use this when a payload schema evolves over time and you want one reusable place to define how each stored version should be decoded.

Constructors

PayloadVersionRegistry({required Map<int, T Function(Map<String, dynamic> payload)> decoders, int? defaultVersion})
Creates a version registry from explicit decoders.
const

Properties

decoders Map<int, T Function(Map<String, dynamic> payload)>
Registered decoder versions.
no setter
defaultVersion int?
Fallback version to use when a stored payload does not persist one.
final
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(Map<String, dynamic> payload, int version, {String typeName = 'payload'}) → T
Decodes payload using the decoder registered for version.
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