TypeInfo<T> class

Represents a Type and its arguments.

Available extensions

Constructors

TypeInfo(Type type, [Iterable<Object>? arguments])
TypeInfo.from(Object o, [Iterable<Object>? arguments, Object? object])
factory
TypeInfo.fromIterableType(Object itrType)
factory
TypeInfo.fromListType(Object listType)
factory
TypeInfo.fromMapType(Object keyType, Object valueType)
factory
TypeInfo.fromObject(T o, [Iterable<Object>? arguments, Object? object])
factory
TypeInfo.fromSetType(Object setType)
factory
TypeInfo.fromType(Type type, [Iterable<Object>? arguments, Object? object])
factory

Properties

arguments → List<TypeInfo>
no setter
arguments0 → TypeInfo?

Available on TypeInfo<T>, provided by the TypeInfoEntityExtension extension

The argument at index 0 (in arguments).
no setter
arguments0 → TypeInfo?
The argument at index 0 (in arguments).
no setter
arguments1 → TypeInfo?

Available on TypeInfo<T>, provided by the TypeInfoEntityExtension extension

The argument at index 1 (in arguments).
no setter
arguments1 → TypeInfo?
The argument at index 1 (in arguments).
no setter
argumentsLength → int
The arguments length.
no setter
asTypeReflection → TypeReflection
Returns this instance as TypeReflection.
no setter
entityType → Type?

Available on TypeInfo<T>, provided by the TypeInfoEntityExtension extension

Returns a valid entity Type.
no setter
entityTypeInfo → TypeInfo?

Available on TypeInfo<T>, provided by the TypeInfoEntityExtension extension

Same as entityType. Returns a valid entity TypeInfo.
no setter
genericType → Type
The generic T Type.
no setter
hasArguments → bool
Returns true if type has arguments.
no setter
hashCode → int
The hash code for this object.
no setteroverride
isAnyType → bool
Returns true if type is Object or dynamic.
no setter
isBasicType → bool
Returns true if type isPrimitiveType or isCollection.
no setter
isBigInt → bool
Returns true if type is BigInt.
no setter
isBool → bool
Returns true if type is bool.
no setter
isCollection → bool
Returns true if type is a collection (List, Iterable, Map or Set).
no setter
isDateTime → bool
Returns true if type is DateTime.
no setter
isDouble → bool
Returns true if type is double.
no setter
isDuration → bool
Returns true if type is Duration.
no setter
isDynamic → bool
Returns true if type is dynamic.
no setter
isDynamicOrObject → bool
Returns true if type is dynamic or Object.
no setter
isEntityReferenceBaseType → bool

Available on TypeInfo<T>, provided by the TypeInfoEntityExtension extension

Returns true if type is equals to EntityReference OR EntityReferenceList.
no setter
isEntityReferenceListType → bool

Available on TypeInfo<T>, provided by the TypeInfoEntityExtension extension

Returns true if type is equals to EntityReferenceList.
no setter
isEntityReferenceType → bool

Available on TypeInfo<T>, provided by the TypeInfoEntityExtension extension

Returns true if type is equals to EntityReference.
no setter
isEntityType → bool
Returns true if type can be an entity (![isDynamicOrObject] && ![isBasicType]).
no setter
isFuture → bool
Returns true if type is a Future.
no setter
isFutureOr → bool
Returns true if type is a FutureOr.
no setter
isInt → bool
Returns true if type is int.
no setter
isIterable → bool
Returns true if type is a Iterable.
no setter
isList → bool
Returns true if type is a List.
no setter
isListEntity → bool
Returns true if type is a List of entities.
no setter
isListEntityOrReference → bool

Available on TypeInfo<T>, provided by the TypeInfoEntityExtension extension

Returns true if isListEntity OR isEntityReferenceListType.
no setter
isMap → bool
Returns true if type is a Map.
no setter
isMapEntry → bool
Returns true if type is a MapEntry.
no setter
isNum → bool
Returns true if type is num.
no setter
isNumber → bool
Returns true if type is int, double or num.
no setter
isObject → bool
Returns true if type is Object.
no setter
isPrimitiveOrDynamicOrObjectType → bool
Returns true if type isPrimitiveType or isDynamicOrObject.
no setter
isPrimitiveType → bool
Returns true if type is primitive (bool, int, double, num or String).
no setter
isSet → bool
Returns true if type is a Set.
no setter
isString → bool
Returns true if type is String.
no setter
isUInt8List → bool
Returns true if type is Uint8List.
no setter
isValidEntityReferenceListType → bool

Available on TypeInfo<T>, provided by the TypeInfoEntityExtension extension

Returns true if isEntityReferenceListType and arguments0 is a valid entity type.
no setter
isValidEntityReferenceType → bool

Available on TypeInfo<T>, provided by the TypeInfoEntityExtension extension

Returns true if isEntityReferenceType and arguments0 is a valid entity type.
no setter
isValidGenericType → bool
Returns true if genericType matches type.
no setter
isValidListEntityOrReferenceType → bool

Available on TypeInfo<T>, provided by the TypeInfoEntityExtension extension

Returns true if isListEntityOrReference AND EntityHandler.isValidEntityType for the entity type (argumentType 0).
no setter
isValidListEntityType → bool

Available on TypeInfo<T>, provided by the TypeInfoEntityExtension extension

Returns true if isListEntity AND EntityHandler.isValidEntityType for the entity type (argumentType 0).
no setter
isVoid → bool
Returns true if type is void.
no setter
listEntityOrReferenceType → TypeInfo?

Available on TypeInfo<T>, provided by the TypeInfoEntityExtension extension

Returns the entity TypeInfo if isListEntityOrReference.
no setter
listEntityType → TypeInfo?
The TypeInfo of the List elements type.
no setter
parser → TypeElementParser<T>?
Returns the type parser.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
type → Type
The main Type.
no setter
typeName → String
Returns the type name.
no setter

Methods

argumentParser<A>(int index) → TypeElementParser<A>?
Returns the parser of the argument at index.
argumentType(int index) → TypeInfo?
Returns the TypeInfo of the argument at index.
callCasted<R>(R f<E>()) → R
Calls f casting T.
callCastedArgumentA<R, A>(R f<A>()) → R
Calls f casting A as arguments0 T.
callCastedArgumentsAB<R, A, B>(R f<A, B>()) → R
Calls f casting A as arguments0 T and B as arguments1 T.
castCollection(Object o, {bool nullable = false}) → Object
Casts o to this collection type if a ClassReflection or EnumReflection for it is registered at ReflectionFactory.
castIterable(Iterable itr, {bool nullable = false}) → Iterable
Casts itr to this type (Iterable<T>) if a ClassReflection or EnumReflection for T is registered at ReflectionFactory.
castList(List list, {bool nullable = false}) → List
Casts list to this type (List<T>) if a ClassReflection or EnumReflection for T is registered at ReflectionFactory.
castMap(Map map, {bool nullable = false}) → Map
Casts map to this type (Map<K,V>), resolving the casting for K and V if there's a ClassReflection or EnumReflection for them registered at ReflectionFactory.
castSet(Set set, {bool nullable = false}) → Set
Casts set to this type (Set<T>) if a ClassReflection or EnumReflection for T is registered at ReflectionFactory.
equalsArgumentsTypes(List<Object> types) → bool
Returns true if arguments have equals types.
equalsEntityType(TypeInfo? other) → bool

Available on TypeInfo<T>, provided by the TypeInfoEntityExtension extension

equalsType(TypeInfo? other) → bool
Returns true if this.type equals to other.type.
equalsTypeAndArguments(TypeInfo other) → bool
Returns true if equalsType and equalsArgumentsTypes are true.
equalsTypeOrEntityType(TypeInfo? other) → bool

Available on TypeInfo<T>, provided by the TypeInfoEntityExtension extension

equivalentArgumentsTypes(List<Object> types) → bool
Returns true if arguments have equivalent types.
fromJson(dynamic json, {JsonDecoder? jsonDecoder, bool duplicatedEntitiesAsID = true, bool? autoResetEntityCache}) → Object?
isCastedIterable(Object? o) → bool
Returns true if o is a Iterable<E> where E is arguments0 T.
isCastedList(Object? o) → bool
Returns true if o is a List<E> where E is arguments0 T.
isCastedMap(Object? o) → bool
Returns true if o is a Map<K,V> where K is arguments0 T and V is arguments1 T.
isCastedMapEntry(Object? o) → bool
Returns true if o is a MapEntry<K,V> where K is arguments0 T and V is arguments1 T.
isCastedSet(Object? o) → bool
Returns true if o is a Set<E> where E is arguments0 T.
isEquivalent(TypeInfo other) → bool
Checks for equivalence, if the instances are similar:
isOf(Type type, [List<Object>? arguments]) → bool
Returns true if this instances has the same type and arguments.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parse<V>(Object? value, [V? def]) → V?
Parse value or return def.
parseEntity<E>(Object? value) → E?

Available on TypeInfo<T>, provided by the TypeInfoEntityExtension extension

parseTraversingFuture<V>(Object? value, [V? def]) → V?
Same as parse but if this isFuture it will traverse to the Future argument.
resolveValue<V>(Object? value, {EntityHandler<T>? entityHandler, EntityProvider? entityProvider, EntityHandlerProvider? entityHandlerProvider, EntityFetcher<T>? entityFetcher, EntityCache? entityCache}) → V?

Available on TypeInfo<T>, provided by the TypeInfoEntityExtension extension

toCastedList<E>(Object? val) → List<E>?

Available on TypeInfo<T>, provided by the TypeInfoEntityExtension extension

toEntityReference(Object? o, {Object? id, Type? type, String? typeName, EntityHandler<T>? entityHandler, EntityProvider? entityProvider, EntityHandlerProvider? entityHandlerProvider, EntityFetcher<T>? entityFetcher, EntityCache? entityCache}) → EntityReference<T>

Available on TypeInfo<T>, provided by the TypeInfoEntityExtension extension

toEntityReferenceList(Object? o, {Type? type, String? typeName, EntityHandler<T>? entityHandler, EntityProvider? entityProvider, EntityHandlerProvider? entityHandlerProvider, EntitiesFetcher<T>? entitiesFetcher, EntityFetcher<T>? entityFetcher, EntityCache? entityCache}) → EntityReferenceList<T>

Available on TypeInfo<T>, provided by the TypeInfoEntityExtension extension

toIterableType() → TypeInfo<Iterable<T>>
Returns this as a TypeInfo for Iterable<T>.
toListType() → TypeInfo<List<T>>
Returns this as a TypeInfo for List<T>.
toMapEntryKeyType<V>({TypeInfo? valueType}) → TypeInfo<MapEntry<T, V>>
Returns this as a TypeInfo for MapEntry<T,V>.
toMapEntryType<V>(TypeInfo valueType) → TypeInfo<MapEntry<T, V>>
Returns this as a TypeInfo for MapEntry<T,V> ensuring that V is the same as valueType.
toMapEntryValueType<K>({TypeInfo? keyType}) → TypeInfo<MapEntry<K, T>>
Returns this as a TypeInfo for MapEntry<K,T>.
toMapKeyType<V>({TypeInfo? valueType}) → TypeInfo<Map<T, V>>
Returns this as a TypeInfo for Map<T,V>.
toMapType<V>(TypeInfo valueType) → TypeInfo<Map<T, V>>
Returns this as a TypeInfo for Map<T,V> ensuring that V is the same as valueType.
toMapValueType<K>({TypeInfo? keyType}) → TypeInfo<Map<K, T>>
Returns this as a TypeInfo for Map<K,T>.
toSetType() → TypeInfo<Set<T>>
Returns this as a TypeInfo for Set<T>.
toString({bool withT = true}) → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
Checks for equality, other should be exactly the same.
override

Static Properties

tVoid → TypeInfo<void>
final

Static Methods

accepts<T>(Type type) → bool
Returns true if T accepts a value of type.
equalsTypeInfoList(List<TypeInfo> a, List<TypeInfo> b) → bool
Returns true if List of TypeInfo a is equals to b.
equalsTypeList(List<Type> a, List<Type> b) → bool
Returns true if List of Type a is equals to b.
equivalentTypeInfoList(List<TypeInfo> a, List<TypeInfo> b) → bool
Returns true if List of TypeInfo a is equivalent to b.
equivalentTypeList(List<Type> a, List<Type> b) → bool
Returns true if List of Type a is equivalent to b.
isPrimitiveTypeFor(Type type) → bool
removeTypeGenerics(String type) → String
Removes generics from the type or record type string.
toList(Iterable<Object> list, {bool growable = false}) → List<TypeInfo>
Converts list to a List of TypeInfo.

Constants

tBigInt → const TypeInfo<BigInt>
tBool → const TypeInfo<bool>
tDateTime → const TypeInfo<DateTime>
tDouble → const TypeInfo<double>
tDuration → const TypeInfo<Duration>
tDynamic → const TypeInfo
tFunction → const TypeInfo<Function>
tFuture → const TypeInfo<Future>
tFutureOr → const TypeInfo<FutureOr>
tInt → const TypeInfo<int>
tIterable → const TypeInfo<Iterable>
tList → const TypeInfo<List>
tMap → const TypeInfo<Map>
tMapEntry → const TypeInfo<Map>
tNum → const TypeInfo<num>
tObject → const TypeInfo<Object>
tSet → const TypeInfo<Set>
tString → const TypeInfo<String>
tUint8List → const TypeInfo<Uint8List>