GenericReader extension

Adds the following methods to ConstantReader: get<T>(), getList<T>(), getSet<T>(), getMap<K, V>(), holdsA<T>().

on
  • ConstantReader

Methods

get<T>() → T
Reads the ConstantReader instance and returns an instance of T.
getDynamic() → dynamic
Reads a constant with type dynamic.
getList<T>() List<T>
Reads the ConstantReader instance and returns an instance of List<T>.
getMap<K, V>() Map<K, V>
Reads constantReader and returns an object of type Map<K, V>.
getSet<T>() Set<T>
Reads the ConstantReader instance and returns an object of type Set<T>.
holdsA<T>() bool
Returns true if the instance of ConstantReader represents an object of type T.

Static Properties

info String
no setter
registeredTypes Set<Type>
Returns a Set containing all types with registered decoders.
no setter
resolvedTypes Set<Type>
Returns a Set containing all types previously resolved from a static type.
no setter

Static Methods

addDecoder<T>(Decoder<T> decoder) bool
Adds or updates a decoder function for type T. Returns true if the decoder was added.
clearDecoder<T>() → void
Clears the decoder function for type T.
hasDecoder<T>() bool
Returns true if a decoder function for type T is registered.
isBuiltIn(Type T) bool
Decoders for (exactly) these types cannot be registered or cleared.
isEnum<T>() bool
Returns true if T is a Dart enum.
isMatch(DartType? dartType, Type type) bool
Returns true if dartType represents the type type.
resolveType(DartType? dartType) Type
Returns a type Type that matches dartType and instance of DartType.