runWithComponent<T> static method

T runWithComponent<T>(
  1. Component component,
  2. T fn()
)

Implementation

static T runWithComponent<T>(Component component, T Function() fn) {
  final previous = _currentComponent;
  _currentComponent = component;

  try {
    return fn();
  } finally {
    _currentComponent = previous;
  }
  // NOTE: NO tocamos _runtime, se mantiene del contexto parent
}