PVBridge class

Storage abstraction layer managing multiple database backends.

Singleton that handles:

  • Platform-specific initialization (web vs mobile/desktop)
  • Multiple storage backends (persistent, in-memory)
  • Database routing by StorageType
  • Store management
  • Secure storage integration
  • Heavy cache isolation (separate database files per environment on non-web)

Example:

final bridge = PVBridge();
final db = await bridge.getDatabaseForType(StorageType.stdSembast);
final store = bridge.getStore('prod', StorageType.stdSembast);

Constructors

PVBridge()
Factory constructor returns the singleton instance.
factory

Properties

dbFactory → DatabaseFactory
Get database factory for current platform.
no setter
hashCode int
The hash code for this object.
no setterinherited
inMemoryDatabase Future<Database>
Get or initialize in-memory database.
no setter
persistentDatabase Future<Database>
Get or initialize persistent database.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

close() Future<void>
Close all databases and reset state.
getDatabaseForType(StorageType type, {bool heavy = false, String? env}) Future<Database>
Get database for the storage type.
getHeavyDatabase(String env) Future<Database>
Get or initialize heavy cache database for a specific environment.
getStore(String env, StorageType type) → StoreRef<String, Map<String, dynamic>>
Get or create sembast store for environment and storage type.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

secureStorage → FlutterSecureStorage
Flutter secure storage for encryption keys and sensitive data.
final
testMode bool
Test mode flag - uses in-memory database for persistent storage.
getter/setter pair