withConnection<R> abstract method

Future<R> withConnection<R>(
  1. Future<R> fn(
    1. Connection connection
    ), {
  2. ConnectionSettings? settings,
  3. L? locality,
})

Acquires a connection from this pool, opening a new one if necessary, and calls fn with it.

The connection must not be used after fn returns as it could be used by another withConnection call later.

Implementation

Future<R> withConnection<R>(
  Future<R> Function(Connection connection) fn, {
  ConnectionSettings? settings,
  L? locality,
});