withJsValuesAsync<T> function

Future<T> withJsValuesAsync<T>(
  1. Future<T> operation(
    1. JsValueScope scope
    )
)

Keeps tracked handles alive until the asynchronous operation completes.

Implementation

Future<T> withJsValuesAsync<T>(
    Future<T> Function(JsValueScope scope) operation) async {
  final scope = JsValueScope();
  try {
    return await operation(scope);
  } finally {
    scope.dispose();
  }
}