close method

void close(
  1. String path, {
  2. String? tableName,
})

Close an existing db connection, if all tables bound to it were released.

Implementation

void close(String path, {String? tableName}) {
  var tableNamesList = _tableNamesMap[path];
  if (tableNamesList != null && tableNamesList.contains(tableName)) {
    tableNamesList.remove(tableName);
  }
  if (tableNamesList == null || tableNamesList.length == 0) {
    // ok to close db and remove the connection
    _tableNamesMap.remove(path);
    GeopackageDb? db = _connectionsMap.remove(path);
    db?.close();
  }
}