hgetall method
Returns all fields and values of the hash stored at key. In the returned value, every field name is followed by its value, so the length of the reply is twice the size of the hash.
Map of fields and their values stored in the hash, or an empty list when key does not exist.
Implementation
Future<Map<String, String?>> hgetall(String key) async {
final result = (await tier1.hgetall(key)).toArray().payload;
final map = <String, String?>{};
if (result != null) {
for (var i = 0; i < result.length; i += 2) {
final key = result[i].toBulkString().payload;
final value = result[i + 1].toBulkString().payload;
if (key != null) {
map[key] = value;
}
}
}
return map;
}