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
elementassignable to this type. -
annotationsOfExact(
Element element, {bool throwOnUnresolved = true}) → Iterable< DartObject> -
Returns annotating constants on
elementof exactly this type. -
firstAnnotationOf(
Element element, {bool throwOnUnresolved = true}) → DartObject? -
Returns the first constant annotating
elementassignable to this type. -
firstAnnotationOfExact(
Element element, {bool throwOnUnresolved = true}) → DartObject? -
Returns the first constant annotating
elementthat is exactly this type. -
hasAnnotationOf(
Element element, {bool throwOnUnresolved = true}) → bool -
Returns if a constant annotating
elementis assignable to this type. -
hasAnnotationOfExact(
Element element, {bool throwOnUnresolved = true}) → bool -
Returns if a constant annotating
elementis exactly this type. -
isAssignableFrom(
Element? element) → bool -
Returns
trueif the type ofelementcan be assigned to this type. -
isAssignableFromType(
DartType? staticType, {List< TypeChecker> args = const []}) → bool -
Returns
trueifstaticTypecan be assigned to this type. -
isExactly(
Element? element) → bool -
Returns
trueif representing the exact same class aselement. -
isExactlyType(
DartType? staticType) → bool -
Returns
trueif representing the exact same type asstaticType. -
isNotAssignableFrom(
Element? element) → bool -
Returns
trueif the type ofelementcan NOT be assigned to this type. -
isNotAssignableFromType(
DartType? staticType, {List< TypeChecker> args = const []}) → bool -
Returns
trueifstaticTypecan NOT be assigned to this type. -
isSuperOf(
Element element) → bool -
Returns
trueif representing a super class ofelement. -
isSuperTypeOf(
DartType staticType) → bool -
Returns
trueif 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