runWith<T> static method

T runWith<T>(
  1. VComponent vComponent,
  2. T action(
    1. VComponent vComponent
    )
)

Implementation

static T runWith<T>(
    VComponent vComponent, T Function(VComponent vComponent) action) {
  final current = VComponent.current;
  VComponent.current = vComponent;
  try {
    final result = action(vComponent);
    return result;
  } catch (e, s) {
    throw WrappedException(
        "An error occurred while executing action '$vComponent.runWith'",
        e,
        s);
  } finally {
    VComponent.current = current;
  }
}