decodeValue method
- @protected
- dynamic value,
- dynamic fromEncodable()?, {
- ValueProcessor processor = ValueProcessor.none,
- List<
int> process(- dynamic
Returns a value decoded from the provided value
bytes
: The list of bytesfromEncodable
: An function that converts between the Map representation and the objectprocessor
: The value transformation to apply if anyprocess
: A transformer function
Returns the decoded value from the provided value
Implementation
@protected
dynamic decodeValue(
dynamic value, dynamic Function(Map<String, dynamic>)? fromEncodable,
{ValueProcessor processor = ValueProcessor.none,
List<int> Function(dynamic)? process}) {
List<int> bytes;
if (processor == ValueProcessor.custom && process != null) {
bytes = process(value);
} else if (processor == ValueProcessor.cast) {
bytes = (value as List).cast<int>();
} else {
if (value is String) {
return value;
} else if (value is Map && fromEncodable != null) {
return fromEncodable(value.cast<String, dynamic>());
} else {
bytes = value as List<int>;
}
}
return decodeBinaryValue(Uint8List.fromList(bytes), fromEncodable);
}