resolvedEngine property Null safety

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 let's users call methods on their top-level database or dao class but run them in a transaction-specific executor.

Implementation

@internal
DatabaseConnectionUser get resolvedEngine {
  return (Zone.current[_zoneRootUserKey] as DatabaseConnectionUser?) ?? this;
}