valkey_client library

A modern, production-ready Dart client for Valkey (9.0.0+). Fully Redis 7.x compatible.

Classes

ClusterNodeInfo
Represents a single node (Master or Replica) in the Valkey cluster.
ClusterSlotRange
Represents a range of hash slots and the nodes responsible for them.
ServerMetadata
Holds metadata about the connected Valkey/Redis server.
Subscription
Represents an active subscription to channels or patterns.
ValkeyClient
The main client implementation for communicating with a Valkey server.
ValkeyClientBase
The abstract base class for a Valkey client.
ValkeyClusterClient
The concrete implementation of ValkeyClusterClientBase.
ValkeyClusterClientBase
The abstract base class for a cluster-aware Valkey client.
ValkeyCommandsBase
The abstract base class for all common Valkey data commands.
ValkeyConnectionSettings
Configuration for a Valkey connection. Holds all configuration options for creating a new connection.
ValkeyLogger
A simple internal logger for the valkey_client.
ValkeyLogLevel
Defines logging severity levels.
ValkeyMessage
Represents a message received from a subscribed channel or pattern.
ValkeyPool
Manages a pool of ValkeyClient connections with robust resource tracking.

Enums

LoadBalancingStrategy
Defines how to distribute read traffic among available replicas.
ReadPreference
Defines which node to select for read operations.
RunningMode
Enum representing the running mode of the server.

Typedefs

AddressMapper = ({String host, int port}) Function(String host, int port)

Exceptions / Errors

FeatureNotImplementedException
Simple exception to signal an intentionally unimplemented feature.
ValkeyClientException
Thrown when a command is issued in an invalid client state.
ValkeyConnectionException
Thrown when the client fails to connect to the server (e.g., connection refused) or if an established connection is lost. Corresponds to socket-level or network errors.
ValkeyException
The base class for all exceptions thrown by the valkey_client package.
ValkeyParsingException
Thrown if the client cannot parse the server's response.
ValkeyServerException
Thrown when the Valkey server returns an error reply (e.g., -ERR, -WRONGPASS). These are errors reported by the server itself, indicating a command could not be processed.