current property

CompileContext get current

Currently executing context based on Zone.current[CompileContext].

Using zones to determine the context is the default behavior unless overrideForTesting is used to set the global context.

If no context has been assigned, either through overrideForTesting or from Zone.current[CompileContext] being available, then an error is thrown.

Implementation

static CompileContext get current {
  final context = _overrideForTesting ?? Zone.current[_compileContextKey];
  if (context == null) {
    _failNoCompileContextConfigured();
  }
  return context as CompileContext;
}