Thrown when a constructing type returns with an Error.

The InstantiationError class contains the original error plus the dependency graph which caused this object to be instantiated.

Example

class A {
  A() {
    throw new Exception('message');
  }
}
 
void main() {
  Injector injector = ReflectiveInjector.resolveAndCreate([A]);
 
  try {
    injector.get(A);
  } catch (e) {
    expect(e, new isInstanceOf<InstantiationError>());
    expect(e.originalException.message, equals('message'));
    expect(e.originalStack, isNotNull);
  }
}
Inheritance

Constructors

InstantiationError(ReflectiveInjector injector, originalException, originalStack, ReflectiveKey key)

Properties

causeKey ReflectiveKey

read-only
context → dynamic

read-only
hashCode → int

Get a hash code for this object.

read-only, inherited
injectors → List<ReflectiveInjector>

read / write
keys → List<ReflectiveKey>

read / write
message → String

read-only, inherited
originalException → dynamic

read-only, inherited
originalStack → dynamic

read-only, inherited
runtimeType → Type

A representation of the runtime type of the object.

read-only, inherited
stackTrace → StackTrace

read-only, inherited
wrapperMessage → String

read-only

Operators

operator ==(other) → bool

The equality operator.

inherited

Methods

addKey(ReflectiveInjector injector, ReflectiveKey key) → void

noSuchMethod(Invocation invocation) → dynamic

Invoked when a non-existent method or property is accessed.

inherited
toString() → String

Returns a string representation of this object.

inherited