getAuto method

Future<List<int>?> getAuto(
  1. String key, {
  2. String? dbName,
})

Retrieves a raw byte value with automatic transaction management.

Uses an automatic read-only transaction.

Parameters:

  • key - Key to retrieve
  • dbName - Optional named database

Returns the value as byte list, or null if not found.

Example:

final bytes = await db.getAuto('key');
if (bytes != null) {
  print('Retrieved ${bytes.length} bytes');
}

Throws StateError if database is closed Throws LMDBException if operation fails

Implementation

Future<List<int>?> getAuto(
  String key, {
  String? dbName,
}) async {
  return _withTransaction(
    (txn) async => get(txn, key, dbName: dbName),
    flags: LMDBFlagSet.readOnly,
  );
}