A simple and easy to use Redis client for Dart

redis_dart

A simple and minimalist Redis client for Dart

Usage

import 'package:redis_dart/redis_dart.dart';

void main() async {
  final client = await RedisClient.connect('localhost');

  await client.set('name', 'Gabriel');

  var res = await client.get('name');
  print(res);

  await client.close();
}

Easy to use

This library was meant to be clear and easy to understand, so the methods names are associated to what the function does, like

void main() async {
  final client = await RedisClient.connect('localhost');

  // this is a HSET command
  await client.setMap('info', {
    'name': 'John Doe',
    'email': 'john@doe.com',
    'age': 34,
  });

  // this one is a HGETALL
  var info = await client.getMap('info');
  print(info);

  await client.close();
}

which returns a Map and then prints

  {name: John Doe, email: john@doe.com, age: 34}

That way, inserting a Redis Hash is as simple as passing a Dart Map.

API

For full API documentation take a look at https://pub.dev/documentation/redis_dart/latest/

Also, check out the examples directory.

GitHub

https://github.com/gabrielpacheco23/redis_dart