useCloseableAsync<R, C extends Closeable> function
Runs passed function and closes this resource after it Closes the resource even if the function throws. The first exception thrown is propagated, if both the function and the close throw, the exception from the function is propagated
Implementation
Future<R> useCloseableAsync<R, C extends Closeable>(
C resource,
FutureOr<R> Function(C p0) fn,
) async {
return resource.runAndCloseAsync<R>(fn);
}