TypeError class

Error thrown by the runtime system when a dynamic type check fails.

Examples include a failed as cast, a null check (!) on null, assigning a dynamic value to a variable of an incompatible type, and passing an argument that fails a covariant parameter check:

List<num> numbers = <int>[1, 2];
numbers.add(1.5); // Throws a TypeError.
Inheritance

Constructors

TypeError()

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
stackTrace → StackTrace?
The stack trace at the point where this error was first thrown.
no setterinherited

Methods

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