close method
Releases resources owned by this database.
Implementations must allow this method to be called more than once.
Implementation
@override
Future<void> close() {
if (_insideTransaction) {
return Future<void>.error(
const SqlException(
SqlErrorCode.unsupported,
'The parent database cannot be closed inside its transaction.',
),
);
}
final existing = _closeFuture;
if (existing != null) return existing;
_closing = true;
return _closeFuture = _serial.run(() async {
await _updates.cancel();
_runSqlite(_database.close, operation: 'close');
});
}