using function

void using(
  1. Pointer<NativeType> ptr,
  2. Future function(
    1. Pointer<NativeType> ptr
    )
)

Implementation

void using(Pointer ptr, Future Function(Pointer ptr) function) async {
  await function.call(ptr);
  allocator.free(ptr);
}