interceptWith method

DriftSession interceptWith(
  1. QueryInterceptor interceptor, {
  2. bool sticky = true,
})

Returns a DriftSession that will use this executor internally, but with calls intercepted by the given interceptor.

This can be used to, for instance, write a custom statement logger or to retry failing statements automatically.

When sticky is enabled (the default), child sessions (e.g. transactions) are also intercepted using the interceptor.

Implementation

DriftSession interceptWith(
  QueryInterceptor interceptor, {
  bool sticky = true,
}) {
  return _InterceptedSession(this, interceptor, sticky);
}