resolvedEngine property

  1. @internal
DatabaseConnectionUser resolvedEngine

A, potentially more specific, database engine based on the Zone context.

Inside a transaction block, drift will replace this resolvedEngine with an engine specific to the transaction. All other methods on this class implicitly use the resolvedEngine to run their SQL statements. This lets users call methods on their top-level database or dao class but run them in a transaction-specific executor.


DatabaseConnectionUser get resolvedEngine {
  final fromZone = Zone.current[_zoneRootUserKey] as DatabaseConnectionUser?;

  if (fromZone != null && fromZone.attachedDatabase == attachedDatabase) {
    return fromZone;
  } else {
    return this;