read method

  1. @override
Future<Object?> read(
  1. String key
)
override

Implementation

@override
Future<Object?> read(String key) async {
  final lines = await _command(utf8.encode('get ${_k(key)}\r\n'));
  // VALUE <key> <flags> <bytes> / <data> / END
  if (lines.length < 3 || !lines.first.startsWith('VALUE')) return null;
  final decoded = jsonDecode(lines[1]);
  return decoded is Map<String, Object?> ? decoded['v'] : null;
}