putAuto method
Convenience methods with automatic transaction management Stores a raw byte value with automatic transaction management.
This is a convenience method that handles transaction creation, commit, and error handling automatically.
Parameters:
key- Key under which to store the valuevalue- Raw bytes to storedbName- Optional named databaseflags- Optional operation flags
Example:
// Simple storage without manual transaction handling
await db.putAuto('key', [1, 2, 3, 4]);
Throws StateError if database is closed Throws LMDBException if operation fails
Implementation
/// Stores a raw byte value with automatic transaction management.
///
/// This is a convenience method that handles transaction creation,
/// commit, and error handling automatically.
///
/// Parameters:
/// * [key] - Key under which to store the value
/// * [value] - Raw bytes to store
/// * [dbName] - Optional named database
/// * [flags] - Optional operation flags
///
/// Example:
/// ```dart
/// // Simple storage without manual transaction handling
/// await db.putAuto('key', [1, 2, 3, 4]);
/// ```
///
/// Throws [StateError] if database is closed
/// Throws [LMDBException] if operation fails
Future<void> putAuto(
String key,
List<int> value, {
String? dbName,
LMDBFlagSet? flags,
}) async {
return _withTransaction(
(txn) async => put(txn, key, value, dbName: dbName, flags: flags),
);
}