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.fromDart(String type, {required String package})
-
Create a new TypeChecker for a dart package
type
.constfactory - TypeChecker.fromPackage(String type, {required String package})
-
Create a new TypeChecker from a type name and respective package name
constfactory
- TypeChecker.fromStatic(DartType type)
-
Create a new TypeChecker backed by a static
type
.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, {List< TypeChecker> args = const []}) → 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
. -
isNotAssignableFrom(
Element? element) → bool -
Returns
true
if the type ofelement
can NOT be assigned to this type. -
isNotAssignableFromType(
DartType? staticType, {List< TypeChecker> args = const []}) → bool -
Returns
true
ifstaticType
can NOT be assigned to this type. -
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