run<T> static method

T run<T>(
  1. T action(
    1. VComponent vComponent
    )
)

Implementation

static T run<T>(T Function(VComponent vComponent) action) {
  final current = VComponent.current;
  if (current == null) {
    throw StateError('The current component is undefined');
  }

  try {
    final result = action(current);
    return result;
  } catch (e, s) {
    throw WrappedException(
        "An error occurred while executing action '$current.run'", e, s);
  } finally {
    VComponent.current = current;
  }
}