Reflection<O> class abstract

Base for reflection.

Implementers

Constructors

Reflection()

Properties

asTypeReflection TypeReflection<O>
Returns reflectedType as a TypeReflection.
no setter
classAnnotations List<Object>
Returns a const List of class annotations.
no setter
fieldsNames List<String>
Returns a const List of fields names.
no setter
hashCode int
The hash code for this object.
no setterinherited
hasObject bool
Returns true if this instances has an associated object (O).
no setter
languageVersion Version
Returns the Dart language Version of the reflected code.
no setter
reflectedType Type
The reflected type by this implementation.
no setter
reflectionFactoryVersion Version
Returns reflection_factory Version used to generate this reflection code.
no setter
reflectionLevel int
The reflection level (complexity).
no setter
reflectionName String
The reflected type name by this implementation. See reflectedType.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
typeInfo TypeInfo
Returns reflectedType as a TypeInfo.
no setter

Methods

callCasted<R>(R function<O>(Reflection<O> reflection)) → R
Calls function with correct casting for this Reflection.
castCollection(dynamic o, TypeInfo typeInfo, {bool nullable = false}) Object?
Cast o to a collection represented by typeInfo.
castIterable(Iterable itr, Type type, {bool nullable = false}) Iterable?
Cast itr to reflectedType if type == reflectedType or return null.
castList(List list, Type type, {bool nullable = false}) List?
Cast list to reflectedType if type == reflectedType or return null.
castMap(Map map, TypeInfo typeInfo, {bool nullable = false}) Map?
Cast map keys & values to reflectedType if type == reflectedType or return null.
castMapKeys(Map map, TypeInfo typeInfo, {bool nullable = false}) Map?
Cast map keys to reflectedType if type == reflectedType or return null.
castMapValues(Map map, TypeInfo typeInfo, {bool nullable = false}) Map?
Cast map values to reflectedType if type == reflectedType or return null.
castSet(Set set, Type type, {bool nullable = false}) Set?
Cast set to reflectedType if type == reflectedType or return null.
fromJson(Object? json) → O
Returns an object instances from json.
fromJsonEncoded(String jsonEncoded) → O
Returns an object instances from jsonEncoded.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
register() → void
Register this reflection implementation.
siblingReflectionFor<T>({T? obj, Type? type}) Reflection<T>?
Returns a Reflection for type, obj or T.
siblingsReflection() List<Reflection>
Returns a List of siblings Reflection (declared in the same code unit).
toJson([O? obj, JsonEncoder? jsonEncoder]) Object?
Returns a JSON.
toJsonEncoded({O? obj, JsonEncoder? jsonEncoder, bool pretty = false}) String
Returns a JSON encoded. See toJson.
toJsonMap({O? obj, JsonEncoder? jsonEncoder}) Map<String, Object?>?
Returns a JSON Map.
toString() String
A string representation of this object.
inherited
withObject([O? obj]) Reflection<O>
Returns a new instances with obj as the associated object (O).
withoutObjectInstance() Reflection<O>
Returns a new instances without an object instance.

Operators

operator ==(Object other) bool
The equality operator.
inherited