TypeChecker class abstract

An abstraction around doing static type checking at compile/build time.

The abstractions are borrowed from the source_gen package. This class provides methods to check type compatibility, examine annotations, and perform other type-related operations.

Constructors

TypeChecker.any(Iterable<TypeChecker> checkers)
Creates a new TypeChecker that can check against the given type.
factory
TypeChecker.fromTypeRef(NamedDartType type)
Creates a new TypeChecker that can check against the given type. Creates a new TypeChecker that can check against the given type.
factory
TypeChecker.fromUrl(String url)
Creates a new TypeChecker that can check against the given type.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

annotationsOf(Element element) Iterable<ElementAnnotation>
Examines the annotations on element related to this type checker.
annotationsOfExact(Element element) Iterable<ElementAnnotation>
Examines the annotations on element related to this type checker.
firstAnnotationOf(Element element) ElementAnnotation?
Examines the annotations on element related to this type checker. Examines the annotations on element related to this type checker.
firstAnnotationOfExact(Element element) ElementAnnotation?
Examines the annotations on element related to this type checker.
hasAnnotationOf(Element element) bool
Examines the annotations on element related to this type checker.
hasAnnotationOfExact(Element element) bool
Examines the annotations on element related to this type checker.
isAssignableFrom(Element element) bool
Checks type assignability according to Dart's type system rules. Checks type assignability according to Dart's type system rules.
isAssignableFromType(DartType typeRef) bool
Checks type assignability according to Dart's type system rules.
isExactly(Element element) bool
Checks if types are exactly the same. Checks if types are exactly the same.
isExactlyType(DartType typeRef) bool
Checks if types are exactly the same.
isSuperOf(Element element) bool
Returns true if representing a super class of element.
isSupertypeOf(DartType type) bool
Returns true if representing a super type of staticType.
matchingTypeOrSupertype(DartType typeRef) NamedDartType?
Finds a matching type or supertype for the given typeRef.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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