Skip to content
pubscout

dart_valkey

0.2.0, released 6 weeks ago by yaminokishi.com

A robust, type-safe Dart client for Valkey and Redis-compatible servers.

$ flutter pub add dart_valkey
Source repository

What it does

It enables Dart applications to connect to Valkey or Redis servers, execute commands, manage Pub/Sub messaging, and interact with JSON modules with type safety.

AI-written summary of version 0.2.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to connect a Dart or Flutter backend/client to Valkey or Redis.
  • You require Pub/Sub messaging support over Redis/Valkey.
  • You are working with RedisJSON modules and need typed document stores.

Skip it when

  • You are looking for an on-device embedded SQL or key-value storage database like SQLite or SharedPreferences.

Strengths

  • Supports SSL certificate management including bad certificate callbacks.
  • Automatic reconnection with exponential backoff and auto-resubscribe for Pub/Sub.
  • Full support for RESP2 and RESP3 protocols automatically.
  • Comprehensive JSON module support with type-safe repository stores.

Weaknesses

  • Requires a running Valkey or Redis server instance for execution and integration testing.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
1

Requires a running Valkey or Redis server instance accessible via host and port.

import 'package:dart_valkey/dart_valkey.dart';

Future<void> main() async {
  final client = ValkeyCommandClient(
    host: 'localhost',
    port: 6379,
  );

  await client.connect();
  await client.set('key', 'value');
  final value = await client.get('key');
  print('Value: $value');

  await client.close();
}

Alternatives

Packages that do the same job and could replace dart_valkey.

  • dart_mcp

    A Dart library for building Model Context Protocol (MCP) servers and clients.

  • mqtt5_client

    A server and browser based MQTT Version 5 client for Dart supporting TCP and WebSockets.

  • mqtt_client

    A Dart MQTT client supporting TCP, WebSocket, secure connections and all QoS levels.

  • shelf_easy

    Lightweight framework with a JSON model generator, database operator, and web/WebSocket server/client.