get method

dynamic get(
  1. String name
)

Retrieves the value associated with name, throwing RuntimeD4rtException("Undefined variable: ...") when it is absent.

Thin wrapper over lookup: this is the throwing contract the bulk of the interpreter relies on. Resolution callers that fall back on a miss (e.g. implicit-this member access in InterpreterVisitor.visitSimpleIdentifier) should call lookup directly to avoid the cost of constructing, throwing and catching an exception — with its stack-trace capture — on every miss.

Implementation

dynamic get(String name) {
  final value = lookup(name);
  if (identical(value, kNotFound)) {
    throw RuntimeD4rtException("Undefined variable: $name");
  }
  return value;
}