JsonMessageCodec<T> constructor
const
JsonMessageCodec<T> ({})
Creates a JsonMessageCodec.
toJson is a function that converts an object of type T to a
Map<String, dynamic>.
fromJson is a function that creates an object of type T from a
Map<String, dynamic>.
toEncodable is an optional function passed to jsonEncode to handle
objects that are not directly encodable to JSON.
reviver is an optional function passed to jsonDecode to transform
decoded values.
Implementation
const JsonMessageCodec({
required Map<String, dynamic>? Function(T) toJson,
required T? Function(Map<String, dynamic>) fromJson,
Object? Function(Object? nonEncodable)? toEncodable,
Object? Function(Object? key, Object? value)? reviver,
}) : _toJson = toJson,
_fromJson = fromJson,
_toEncodable = toEncodable,
_reviver = reviver;