import 'package:redis/redis.dart'; class Redis { final RedisConfig _config; Command? _command; Redis(this._config); static late Redis _redis; static Redis getInstance() { return _redis; } static void setInstance(Redis redis) { _redis = redis; } Future connect() async { _command = await RedisConnection().connect(_config.host, _config.port); } Future set(String key, String value) async { var response = await _command?.send_object(["SET", key, value]); return response == "OK"; } Future get(String key) async { return await _command?.send_object(["GET", key]); } } class RedisConfig { String host; int port; RedisConfig( {required this.host, this.port = 6379,}); }