use<R> method

R use<R>(
  1. R callback(
    1. T
    )
)

Applies callback on this object and then delete the underlying JNI reference, returning the result of callback.

Implementation

R use<R>(R Function(T) callback) {
  try {
    final result = callback(this);
    return result;
  } finally {
    this?.release();
  }
}