getConnectionWithStatus static method

Future<(Database, bool)> getConnectionWithStatus()

Returns the database instance along with its availability status. This should be used only for automated background tasks where access must not interfere with interactive or user-driven operations (e.g., sync jobs).

Implementation

static Future<(sqlite.Database, bool)> getConnectionWithStatus() async {
  if (_dbFuture == null) {
    throw Exception("Database not connected. Call connect() first");
  }

  final db = await _dbFuture!;
  final locked = _isLocked();
  return (db, !locked);
}