get method

  1. @override
Future<AtData?> get(
  1. String key
)
override

Retrieves the value mapped to key, or null if no mapping exists. Implementations may also throw a backend-specific not-found exception (e.g. KeyNotFoundException) instead of returning null — consult the concrete impl.

Implementation

@override
Future<AtData?> get(String key) async {
  final k = _normalize(key);
  final rows = _db.raw
      .select('SELECT value, metadata FROM at_data WHERE atkey = ?;', [k]);
  if (rows.isEmpty) {
    throw KeyNotFoundException('$key does not exist in keystore');
  }
  return _atDataFromRow(rows.first, k);
}