TypeChecker class abstract
An abstraction around doing static type checking at compile/build time.
Constructors
-
TypeChecker.any(Iterable<
TypeChecker> checkers) -
Creates a new TypeChecker that delegates to other
checkers
.constfactory -
TypeChecker.every(Iterable<
TypeChecker> checkers) -
Creates a new TypeChecker that delegates to other
checkers
.constfactory - TypeChecker.fromName(String name, {bool ignoreGenerics, String? packageName})
-
Checks that the element has a specific name, and optionally checks that it
is defined from a specific package.
constfactory
- TypeChecker.fromPackage(String packageName)
-
Checks that the element comes from a specific package.
constfactory
- TypeChecker.fromStatic(DartType type)
-
Create a new TypeChecker backed by a static
type
.constfactory - TypeChecker.fromUrl(dynamic url)
-
Create a new TypeChecker backed by a library
url
.constfactory
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, {bool throwOnUnresolved = true}) → Iterable< DartObject> -
Returns annotating constants on
element
assignable to this type. -
annotationsOfExact(
Element element, {bool throwOnUnresolved = true}) → Iterable< DartObject> -
Returns annotating constants on
element
of exactly this type. -
firstAnnotationOf(
Element element, {bool throwOnUnresolved = true}) → DartObject? -
Returns the first constant annotating
element
assignable to this type. -
firstAnnotationOfExact(
Element element, {bool throwOnUnresolved = true}) → DartObject? -
Returns the first constant annotating
element
that is exactly this type. -
hasAnnotationOf(
Element element, {bool throwOnUnresolved = true}) → bool -
Returns if a constant annotating
element
is assignable to this type. -
hasAnnotationOfExact(
Element element, {bool throwOnUnresolved = true}) → bool -
Returns if a constant annotating
element
is exactly this type. -
isAssignableFrom(
Element element) → bool -
Returns
true
if the type ofelement
can be assigned to this type. -
isAssignableFromType(
DartType staticType) → bool -
Returns
true
ifstaticType
can be assigned to this type. -
isExactly(
Element element) → bool -
Returns
true
if representing the exact same class aselement
. -
isExactlyType(
DartType staticType) → bool -
Returns
true
if representing the exact same type asstaticType
. -
isSuperOf(
Element element) → bool -
Returns
true
if representing a super class ofelement
. -
isSuperTypeOf(
DartType staticType) → bool -
Returns
true
if representing a super type ofstaticType
. -
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