open method

GeopackageDb open(
  1. String path, {
  2. String? tableName,
})

Open a new db or retrieve it from the cache.

The tableName can be added to keep track of the tables that still need an open connection boudn to a given path.

Implementation

GeopackageDb open(String path, {String? tableName}) {
  GeopackageDb? db = _connectionsMap[path];
  if (db == null) {
    db = GeopackageDb(path);
    // db.doRtreeTestCheck = doRtreeCheck;
    db.forceVectorMobileCompatibility = forceVectorMobileCompatibility;
    db.forceRasterMobileCompatibility = forceRasterMobileCompatibility;
    db.openOrCreate();

    _connectionsMap[path] = db;
  }
  var namesList = _tableNamesMap[path];
  if (namesList == null) {
    namesList = <String>[];
    _tableNamesMap[path] = namesList;
  }
  if (tableName != null && !namesList.contains(tableName)) {
    namesList.add(tableName);
  }
  return db;
}