decodeDynamicFieldValue method
Decodes a value for a dynamic model field from protocol or database
shapes: a JSON String from encodeWithType, or a Map when JSON was
parsed before deserialization.
Implementation
dynamic decodeDynamicFieldValue(Object? value) {
if (value == null) return null;
if (value is String) return decodeWithType(value);
if (value is Map<String, dynamic>) return deserializeByClassName(value);
throw FormatException(
'Dynamic fields are serialized as a Map with the type, but got '
'${value.runtimeType} instead.',
);
}