Flutter & Redis client

2,204

You can use package https://pub.dev/packages/redis
This package is Redis client for Dart

code snippet

import 'package:redis/redis.dart';
...
RedisConnection conn = new RedisConnection();
conn.connect('localhost',6379).then((Command command){
    command.send_object(["SET","key","0"]).then((var response)
        print(response);
    )
}
Share:
2,204
harunB10
Author by

harunB10

Updated on December 17, 2022

Comments

  • harunB10
    harunB10 over 1 year

    I have (Chat) Flutter mobile app which uses Lumen as backend. However, I want to cache some things and would like to use Redis for this purpose. Is there a way how Flutter app can speak with Redis? Should I install some package for this or make HTTP request for every caching?

    My goal is to store last conversation message.

    On backend side I can do something like this:

    Redis::hSet('chat1', 'message', 'hello');
    

    But I am not sure how this is going to affect performance... Therefore it would be better to have Redis client on Frontend side (Flutter).