close method
Stops owned streams and watches, drains pending work, then closes the driver.
Only the root database can close its driver. New operations are rejected once closing starts; concurrent close calls await the same cleanup.
Implementation
Future<void> close() async {
if (_connection != null) {
throw const OrmException(
'SESSION.BORROWED',
'A borrowed session cannot close its driver.',
);
}
await (_closing ??= _close());
}