typeredis library

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

Classes

BitFieldOp
Helper class to construct BITFIELD operations
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.
Config
GeoLocation
Helper class for GeoLocation points
GeoSearchOptions
Helper class for GeoSearch (R620+, and legacy GeoRadius) options
JsonMSetEntry
A helper class for JSON.MSET command. Represents a single triplet of (key, path, value).
ScanResult
Result for SCAN command A DTO to hold the result of a SCAN operation.
ServerMetadata
Holds metadata about the connected Valkey/Redis server.
StreamEntry
Helper class to represent a Stream Entry (ID + Fields)
Subscription
Represents an active subscription to channels or patterns.
TRClient
The main client implementation for communicating with a Redis/Valkey server.
TRClientBase
The abstract base class for a Redis/Valkey client.
TRClusterClient
The concrete implementation of TRClusterClientBase.
TRClusterClientBase
The abstract base class for a cluster-aware Redis/Valkey client.
TRCommandsBase
The abstract base class for all common Redis/Valkey data commands.
TRConnectionSettings
Configuration for a Valkey connection. Holds all configuration options for creating a new connection.
TRLogger
A simple internal logger for the typeredis.
TRLogLevel
Defines logging severity levels.
TRMessage
Represents a message received from a subscribed channel or pattern.
TRPool
Manages a pool of TRClient 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.

Mixins

JsonCommands
Mixin to support Redis-JSON and Valkey-JSON commands. This mixin ensures compatibility with the existing execute method by converting all parameters to Strings before sending.

Extensions

AppendCommand on StringCommands
BitCountCommand on BitmapCommands
BitFieldCommand on BitmapCommands
BitFieldRoCommand on BitmapCommands
BitOpCommand on BitmapCommands
BitPosCommand on BitmapCommands
BLMoveCommand on ListCommands
BLMPopCommand on ListCommands
BloomFilterTemplateCommand on BloomFilterCommands
BLPopCommand on ListCommands
BRPopCommand on ListCommands
BRPopLPushCommand on ListCommands
BzMPopCommand on SortedSetCommands
BzPopMaxCommand on SortedSetCommands
BzPopMinCommand on SortedSetCommands
CFTemplateCommand on CuckooFilterCommands
ClusterTemplateCommand on ClusterCommands
CMSTemplateCommand on CountMinSketchCommands
ConfigGetCommand on ServerCommands
Helper to get a single config value. Returns null if not found/error.
ConfigRewriteCommand on ServerCommands
ConfigSetCommand on ServerCommands
ConnectionTemplateCommand on ConnectionCommands
DecrByCommand on StringCommands
DecrCommand on StringCommands
DelCommand on GenericCommands
DelExCommand on StringCommands
DelIfEqCommand on StringCommands
DigestCommand on StringCommands
DiscardCommand on TransactionsCommands
ExecCommand on TransactionsCommands
FlushAllCommand on ServerCommands
FlushDbCommand on ServerCommands
GeoAddCommand on GeospatialIndicesCommands
GeoDistCommand on GeospatialIndicesCommands
GeoHashCommand on GeospatialIndicesCommands
GeoPosCommand on GeospatialIndicesCommands
GeoRadiusByMemberCommand on GeospatialIndicesCommands
GeoRadiusByMemberRoCommand on GeospatialIndicesCommands
GeoRadiusCommand on GeospatialIndicesCommands
GeoRadiusRoCommand on GeospatialIndicesCommands
GeoSearchCommand on GeospatialIndicesCommands
GeoSearchStoreCommand on GeospatialIndicesCommands
GetBitCommand on BitmapCommands
GetCommand on StringCommands
GetDelCommand on StringCommands
GetExCommand on StringCommands
GetRangeCommand on StringCommands
GetSetCommand on StringCommands
HDelCommand on HashCommands
HExistsCommand on HashCommands
HExpireAtCommand on HashCommands
HExpireCommand on HashCommands
HExpireTimeCommand on HashCommands
HGetAllCommand on HashCommands
HGetCommand on HashCommands
HGetDelCommand on HashCommands
HGetExCommand on HashCommands
HIncrByCommand on HashCommands
HIncrByFloatCommand on HashCommands
HKeysCommand on HashCommands
HLenCommand on HashCommands
HMGetCommand on HashCommands
HMSetCommand on HashCommands
HPersistCommand on HashCommands
HPExpireAtCommand on HashCommands
HPExpireCommand on HashCommands
HPExpireTimeCommand on HashCommands
HPTtlCommand on HashCommands
HRandFieldCommand on HashCommands
HScanCommand on HashCommands
HSetCommand on HashCommands
HSetExCommand on HashCommands
HSetNxCommand on HashCommands
HStrLenCommand on HashCommands
HTtlCommand on HashCommands
HValsCommand on HashCommands
IncrByCommand on StringCommands
IncrByFloatCommand on StringCommands
IncrCommand on StringCommands
InfoCommand on ServerCommands
InfoServerMetadataCommand on ServerCommands
JsonArrAppendCommand on JsonCommands
JsonArrAppendEnhancedCommand on JsonCommands
JsonArrIndexCommand on JsonCommands
JsonArrIndexEnhancedCommand on JsonCommands
JsonArrInsertCommand on JsonCommands
JsonArrInsertEnhancedCommand on JsonCommands
JsonArrLenCommand on JsonCommands
JsonArrLenEnhancedCommand on JsonCommands
JsonArrPopCommand on JsonCommands
JsonArrPopEnhancedCommand on JsonCommands
JsonArrTrimCommand on JsonCommands
JsonArrTrimEnhancedCommand on JsonCommands
JsonClearCommand on JsonCommands
JsonDebugCommand on JsonCommands
JsonDebugDepthCommand on JsonCommands
JsonDebugFieldsCommand on JsonCommands
JsonDebugHelpCommand on JsonCommands
JsonDebugKeyTableCheckCommand on JsonCommands
JsonDebugKeyTableCorruptCommand on JsonCommands
JsonDebugKeyTableDistributionCommand on JsonCommands
JsonDebugMaxDepthKeyCommand on JsonCommands
JsonDebugMaxSizeKeyCommand on JsonCommands
JsonDebugMemoryCommand on JsonCommands
JsonDebugTestSharedApiCommand on JsonCommands
JsonDelCommand on JsonCommands
JsonForgetCommand on JsonCommands
JsonGetCommand on JsonCommands
JsonMergeCommand on JsonCommands
JsonMergeForceCommand on JsonCommands
JsonMGetCommand on JsonCommands
JsonMSetCommand on JsonCommands
JsonNumIncrByCommand on JsonCommands
JsonNumMultByCommand on JsonCommands
JsonObjKeysCommand on JsonCommands
JsonObjKeysEnhancedCommand on JsonCommands
JsonObjLenCommand on JsonCommands
JsonRespCommand on JsonCommands
JsonSetCommand on JsonCommands
JsonStrAppendCommand on JsonCommands
JsonStrAppendEnhancedCommand on JsonCommands
JsonStrLenCommand on JsonCommands
JsonStrLenEnhancedCommand on JsonCommands
JsonToggleCommand on JsonCommands
JsonTypeCommand on JsonCommands
LcsCommand on StringCommands
LIndexCommand on ListCommands
LInsertCommand on ListCommands
LLenCommand on ListCommands
LMoveCommand on ListCommands
LMPopCommand on ListCommands
LPopCommand on ListCommands
LPosCommand on ListCommands
LPushCommand on ListCommands
LPushXCommand on ListCommands
LRangeCommand on ListCommands
LRemCommand on ListCommands
LSetCommand on ListCommands
LTrimCommand on ListCommands
MGetCommand on StringCommands
MSetCommand on StringCommands
MSetExCommand on StringCommands
MSetNxCommand on StringCommands
MultiCommand on TransactionsCommands
PfAddCommand on HyperLogLogCommands
PfCountCommand on HyperLogLogCommands
PfDebugCommand on HyperLogLogCommands
PfMergeCommand on HyperLogLogCommands
PfSelfTestCommand on HyperLogLogCommands
PSetExCommand on StringCommands
PubsubTemplateCommand on PubsubCommands
RPopCommand on ListCommands
RPopLPushCommand on ListCommands
RPushCommand on ListCommands
RPushXCommand on ListCommands
SAddCommand on SetCommands
SAFTemplateCommand on ScriptingAndFunctionsCommands
ScanCommand on GenericCommands
SCardCommand on SetCommands
SDiffCommand on SetCommands
SDiffStoreCommand on SetCommands
SearchTemplateCommand on SearchCommands
SetBitCommand on BitmapCommands
SetCommand on StringCommands
SetExCommand on StringCommands
SetNxCommand on StringCommands
SetRangeCommand on StringCommands
SInterCardCommand on SetCommands
SInterCommand on SetCommands
SInterStoreCommand on SetCommands
SIsMemberCommand on SetCommands
SMembersCommand on SetCommands
SMIsMemberCommand on SetCommands
SMoveCommand on SetCommands
SPopCommand on SetCommands
SRandMemberCommand on SetCommands
SRemCommand on SetCommands
SScanCommand on SetCommands
StrLenCommand on StringCommands
SubStrCommand on StringCommands
SUnionCommand on SetCommands
SUnionStoreCommand on SetCommands
TDTemplateCommand on TDigestSketchCommands
TopKTemplateCommand on TopKSketchCommands
TSTemplateCommand on TimeSeriesCommands
TypeCommand on GenericCommands
UnwatchCommand on TransactionsCommands
VSTemplateCommand on VectorSetCommands
WatchCommand on TransactionsCommands
XAckCommand on StreamCommands
XAddCommand on StreamCommands
XAutoClaimCommand on StreamCommands
XClaimCommand on StreamCommands
XDelCommand on StreamCommands
XGroupCommand on StreamCommands
XGroupCreateCommand on StreamCommands
XGroupCreateConsumerCommand on StreamCommands
XGroupDelConsumerCommand on StreamCommands
XGroupDestroyCommand on StreamCommands
XGroupHelpCommand on StreamCommands
XGroupSetIdCommand on StreamCommands
XInfoCommand on StreamCommands
XInfoConsumersCommand on StreamCommands
XInfoGroupsCommand on StreamCommands
XInfoHelpCommand on StreamCommands
XInfoStreamCommand on StreamCommands
XLenCommand on StreamCommands
XPendingCommand on StreamCommands
XRangeCommand on StreamCommands
XReadCommand on StreamCommands
XReadGroupCommand on StreamCommands
XRevRangeCommand on StreamCommands
XSetIdCommand on StreamCommands
XTrimCommand on StreamCommands
ZAddCommand on SortedSetCommands
ZCardCommand on SortedSetCommands
ZCountCommand on SortedSetCommands
ZDiffCommand on SortedSetCommands
ZDiffStoreCommand on SortedSetCommands
ZIncrByCommand on SortedSetCommands
ZInterCardCommand on SortedSetCommands
ZInterCommand on SortedSetCommands
ZInterStoreCommand on SortedSetCommands
ZLexCountCommand on SortedSetCommands
ZMPopCommand on SortedSetCommands
ZMScoreCommand on SortedSetCommands
ZPopMaxCommand on SortedSetCommands
ZPopMinCommand on SortedSetCommands
ZRandMemberCommand on SortedSetCommands
ZRangeByLexCommand on SortedSetCommands
ZRangeByScoreCommand on SortedSetCommands
ZRangeCommand on SortedSetCommands
ZRangeStoreCommand on SortedSetCommands
ZRankCommand on SortedSetCommands
ZRemCommand on SortedSetCommands
ZRemRangeByLexCommand on SortedSetCommands
ZRemRangeByRankCommand on SortedSetCommands
ZRemRangeByScoreCommand on SortedSetCommands
ZRevRangeByLexCommand on SortedSetCommands
ZRevRangeByScoreCommand on SortedSetCommands
ZRevRangeCommand on SortedSetCommands
ZRevRankCommand on SortedSetCommands
ZScanCommand on SortedSetCommands
ZScoreCommand on SortedSetCommands
ZUnionCommand on SortedSetCommands
ZUnionStoreCommand on SortedSetCommands

Typedefs

DragonflyClient = TRClient
Alias for TRClient. Use this for Standalone/Sentinel connections.
DragonflyClientException = TRClientException
Alias for TRClientException. Thrown on invalid API usage.
DragonflyClusterClient = TRClusterClient
Alias for TRClusterClient. Use this for Cluster connections.
DragonflyConnectionException = TRConnectionException
Alias for TRConnectionException. Thrown on network/socket errors.
DragonflyConnectionSettings = TRConnectionSettings
Alias for TRConnectionSettings.
DragonflyException = TRException
Alias for TRException. The base class for all exceptions.
DragonflyLogLevel = TRLogLevel
Alias for TRLogLevel.
DragonflyMessage = TRMessage
Alias for TRMessage. Represents a Pub/Sub message.
DragonflyParsingException = TRParsingException
Alias for TRParsingException. Thrown on protocol parsing errors.
DragonflyPool = TRPool
Alias for TRPool. Use this for connection pooling.
DragonflyServerException = TRServerException
Alias for TRServerException. Thrown when the server responds with an error.
GeoRadiusOptions = GeoSearchOptions
RedisClient = TRClient
Alias for TRClient. Use this for Standalone/Sentinel connections.
RedisClientException = TRClientException
Alias for TRClientException. Thrown on invalid API usage.
RedisClusterClient = TRClusterClient
Alias for TRClusterClient. Use this for Cluster connections.
RedisConnectionException = TRConnectionException
Alias for TRConnectionException. Thrown on network/socket errors.
RedisConnectionSettings = TRConnectionSettings
Alias for TRConnectionSettings.
RedisException = TRException
Alias for TRException. The base class for all exceptions.
RedisLogLevel = TRLogLevel
Alias for TRLogLevel.
RedisMessage = TRMessage
Alias for TRMessage. Represents a Pub/Sub message.
RedisParsingException = TRParsingException
Alias for TRParsingException. Thrown on protocol parsing errors.
RedisPool = TRPool
Alias for TRPool. Use this for connection pooling.
RedisServerException = TRServerException
Alias for TRServerException. Thrown when the server responds with an error.
ValkeyClient = TRClient
Alias for TRClient. Use this for Standalone/Sentinel connections.
ValkeyClientException = TRClientException
Alias for TRClientException. Thrown on invalid API usage.
ValkeyClusterClient = TRClusterClient
Alias for TRClusterClient. Use this for Cluster connections.
ValkeyConnectionException = TRConnectionException
Alias for TRConnectionException. Thrown on network/socket errors.
ValkeyConnectionSettings = TRConnectionSettings
Alias for TRConnectionSettings.
ValkeyException = TRException
Alias for TRException. The base class for all exceptions.
ValkeyLogLevel = TRLogLevel
Alias for TRLogLevel.
ValkeyMessage = TRMessage
Alias for TRMessage. Represents a Pub/Sub message.
ValkeyParsingException = TRParsingException
Alias for TRParsingException. Thrown on protocol parsing errors.
ValkeyPool = TRPool
Alias for TRPool. Use this for connection pooling.
ValkeyServerException = TRServerException
Alias for TRServerException. Thrown when the server responds with an error.

Exceptions / Errors

FeatureNotImplementedException
Simple exception to signal an intentionally unimplemented feature.
TRClientException
Thrown when a command is issued in an invalid client state.
TRConnectionException
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.
TRException
The base class for all exceptions thrown by the typeredis package.
TRParsingException
Thrown if the client cannot parse the server's response.
TRServerException
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.