MappedDecoder class abstract
A decoder that can decode direct-access collections of key-value pairs of data.
A Decodable implementation can access and decode each value based on the provided key or id.
Formats may choose to use either the key
or id
parameter to access the value, as some formats use
String keys like JSON and others use int ids like Protobuf. The Decodable implementation should
provide values for both. If no id is provided, formats like Protobuf may not work.
A Decodable implementation can also get all keys of the collection using the keys property.
- Implementers
- Available extensions
Constructors
Properties
Methods
-
decodeBool(
String key, {int? id}) → bool - Decodes the data for the given key or id as a boolean value.
-
decodeBoolOrNull(
String key, {int? id}) → bool? - Decodes the data for the given key or id as a nullable boolean value.
-
decodeDouble(
String key, {int? id}) → double - Decodes the data for the given key or id as a double value.
-
decodeDoubleOrNull(
String key, {int? id}) → double? - Decodes the data for the given key or id as a nullable double value.
-
decodeFuture<
T> (String key, {int? id, Decodable< T> ? using}) → Future<T> -
Available on MappedDecoder, provided by the AsyncMappedDecoder extension
Decodes a Future ofT
using the provided Decodable. -
decodeFutureOrNull<
T> (String key, {int? id, Decodable< T> ? using}) → Future<T> ? -
Available on MappedDecoder, provided by the AsyncMappedDecoder extension
Decodes a Future ofT
or null using the provided Decodable. -
decodeInt(
String key, {int? id}) → int - Decodes the data for the given key or id as an integer value.
-
decodeIntOrNull(
String key, {int? id}) → int? - Decodes the data for the given key or id as a nullable integer value.
-
decodeIsNull(
String key, {int? id}) → bool - Checks if the data for the given key or id is null.
-
decodeIterated(
String key, {int? id}) → IteratedDecoder - Decodes the data for the given key or id as an iterated collection of nested data.
-
decodeKeyed(
String key, {int? id}) → KeyedDecoder - Decodes the data for the given key or id as a iterated collection of key-value pairs of nested data.
-
decodeList<
E> (String key, {int? id, Decodable< E> ? using}) → List<E> - Decodes the data for the given key or id as a list of elements.
-
decodeListOrNull<
E> (String key, {int? id, Decodable< E> ? using}) → List<E> ? - Decodes the data for the given key or id as a nullable list of elements.
-
decodeMap<
K, V> (String key, {int? id, Decodable< K> ? keyUsing, Decodable<V> ? valueUsing}) → Map<K, V> - Decodes the data for the given key or id as a map of key-value pairs.
-
decodeMapOrNull<
K, V> (String key, {int? id, Decodable< K> ? keyUsing, Decodable<V> ? valueUsing}) → Map<K, V> ? - Decodes the data for the given key or id as a nullable map of key-value pairs.
-
decodeMapped(
String key, {int? id}) → MappedDecoder - Decodes the data for the given key or id as a direct-access collection of key-value pairs of nested data.
-
decodeNum(
String key, {int? id}) → num - Decodes the data for the given key or id as a num value.
-
decodeNumOrNull(
String key, {int? id}) → num? - Decodes the data for the given key or id as a nullable num value.
-
decodeObject<
T> (String key, {int? id, Decodable< T> ? using}) → T -
Decodes the data for the given key or id as an object of type
T
. -
decodeObjectOrNull<
T> (String key, {int? id, Decodable< T> ? using}) → T? -
Decodes the data for the given key or id as a nullable object of type
T
. -
decodeReference<
T> (String key, {int? id, Decodable< T> ? using}) → Reference<T> -
Available on MappedDecoder, provided by the ReferenceMappedDecoder extension
Decodes a Reference ofT
using the provided Decodable. -
decodeReferenceOrNull<
T> (String key, {int? id, Decodable< T> ? using}) → Reference<T> ? -
Available on MappedDecoder, provided by the ReferenceMappedDecoder extension
Decodes a Reference ofT
or null using the provided Decodable. -
decodeStream<
T> (String key, {int? id, Decodable< T> ? using}) → Stream<T> -
Available on MappedDecoder, provided by the AsyncMappedDecoder extension
Decodes a Stream ofT
using the provided Decodable. -
decodeStreamOrNull<
T> (String key, {int? id, Decodable< T> ? using}) → Stream<T> ? -
Available on MappedDecoder, provided by the AsyncMappedDecoder extension
Decodes a Stream ofT
or null using the provided Decodable. -
decodeString(
String key, {int? id}) → String - Decodes the data for the given key or id as a string value.
-
decodeStringOrNull(
String key, {int? id}) → String? - Decodes the data for the given key or id as a nullable string value.
-
expect(
String key, String expect, {int? id}) → Never - Throws an exception with a detailed message.
-
isHumanReadable(
) → bool - Whether a Decodable implementation should expect to decode their human-readable form.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
whatsNext(
String key, {int? id}) → DecodingType - Returns the actual or preferred DecodingType of the encoded data for the given key or id.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited