adapters library

Classes

AccessContext
The current access context (user/session).
AccessControl
Manages fine-grained access control for box operations.
AccessRule
An access control rule.
AdapterSpec<T>
Configuration that specifies the generation of a TypeAdapter
AdaptiveCache<K, V>
Smart cache that adapts its strategy based on access patterns.
AdaptiveCacheStats
Statistics about cache performance.
AggregationOp
An aggregation operation to perform during grouping.
AggregationPipeline
MongoDB-style aggregation pipeline for Rift. Allows complex data analysis without extracting data from the database.
AsyncFieldRule
Async validation rule that performs asynchronous checks.
AsyncValidationError
Enhanced validation error for async rules.
AuditEntry
A single audit log entry.
AuditLog
Event log and audit trail for Rift. Records all modifications with timestamps for compliance and debugging.
BackgroundCompactor
Background compaction for Rift boxes. Performs incremental compaction without blocking reads.
BackupManager
Backup and restore for Rift databases.
BatchLoader<K, V>
Batches multiple lazy load requests into single batch operations.
BinaryMetadata
Metadata for a stored binary entry.
BinaryReader
The BinaryReader is used to bring data back from the binary format on the disk.
BinaryReaderImpl
Not part of public API
BinaryWriter
The BinaryWriter is used to encode data to the binary format.
BinaryWriterImpl
Not part of public API
BloomFilter
Bloom filter for fast key existence checking. Reduces disk I/O by quickly determining if a key definitely doesn't exist.
Box<E>
Boxes contain all of your data. In the browser, each box has its own IndexedDB database. On all other platforms, each Box is stored in a separate file in the Rift home directory.
BoxBase<E>
Boxes contain all of your data. In the browser, each box has its own IndexedDB database. On all other platforms, each Box is stored in a seperate file in the Rift home directory.
BoxCollection
TODO: Document this!
BoxEvent
A event representing a change in a box.
BoxMigrationResult
Result of migrating a single box from Hive to Rift.
BoxSnapshot
A snapshot of a box's state at a specific version.
BoxSnapshotData
An immutable snapshot of a box's state at a specific version.
BulkOperations
High-performance bulk operations for Rift boxes.
CachedLazyBox<E>
A LazyBox wrapper that adds an LRU caching layer.
CacheStats
Statistics about cache performance and utilization.
CDCEvent
A single CDC event.
CDCFilter
Filter for CDC events.
CDCManager
Change Data Capture (CDC) for Rift. Emits structured change events for sync, audit, and integration.
ChangeTracker
Tracks local changes for sync.
CodecRegistry
Registry of codecs for different types.
CollectionBox<V>
represents a Box being part of a BoxCollection
ColorAdapter
CompactionEvent
Event emitted when a box is compacted.
CompositeIndex
A composite index spanning multiple fields.
CompressionDictionary
A shared compression dictionary for similar data.
ComputedFieldTransform
Adds a computed field based on existing fields.
CostEstimate
Cost estimation for a query execution plan.
CRDTDocument
A CRDT document that can sync across devices without conflicts. Uses a vector clock to track causality and resolves conflicts using last-writer-wins semantics with vector clock comparison.
CrossBoxTransaction
Cross-box atomic transactions. Ensures consistency when modifying multiple boxes atomically.
CrossFieldRule
Cross-field validation rule that validates based on multiple fields.
CrossFieldValidationRules
Pre-built cross-field validation rules.
CustomPartitionStrategy
Custom partitioning strategy using a user-provided function.
DataDiffer
Computes deep diffs between two maps.
DataMasker
Main class for masking sensitive data.
DataPatch
A patch that can transform one data state into another.
DataSanitizer
Main class for sanitizing input data.
DataTransform
Base class for data transforms.
DataValidationSchema
Defines a data validation schema for a box.
DictionaryCompressor
Dictionary-based compressor for structured data.
EnhancedSchemaValidator
Enhanced schema validator with async validation support.
EnhancedValidationResult
Enhanced validation result with async errors.
EnhancedValidationSchema
Enhanced validation schema with async and cross-field support.
EntryVersion
Represents a single version of an entry.
Event
A typed event with metadata.
EventReplay
Replays events to rebuild state.
EventStore<T>
Append-only event storage.
ExtensionTypeAdapter<T>
Support for Dart 3 extension types as Rift-storable values. Extension types provide zero-cost type wrappers with full type safety.
FieldAccessor<T>
Accessor for a single field of an object.
FieldEncryption
Field-level encryption for Rift boxes. Allows different encryption keys and algorithms per field.
FieldEncryptionConfig
Configuration for encrypting a specific field.
FieldRule
A single validation rule for a field.
FieldValidationResult
Validation result for a form field.
FieldValidator<T>
A validator for a form field.
FileHeader
RIFT file header structure for database files.
FilterCondition
A single filter condition for a query.
FilterDesc
Description of a filter in a query analysis.
FilterFieldsTransform
Filters data to only include the specified fields.
FTSEngine
Full-text search engine with inverted index, TF-IDF scoring, and basic English stemming.
FTSQuery
A full-text search query that specifies what to search for and how.
FTSResult
Represents a single search result from a full-text search query.
GCounter
CRDT types for conflict-free distributed data. Supports counters, sets, maps, and registers with automatic conflict resolution. G-Counter (Grow-only counter) - can only increment. Each node maintains its own count. The total value is the sum of all node counts. Merge takes the maximum per node.
GenerateAdapters
Annotation to generate TypeAdapters for the given specs
GeoBoundingBox
A geographic bounding box defined by latitude/longitude ranges.
GeoPoint
A geographic coordinate point.
GeoQuery
Geospatial query support for Rift. Allows searching by geographic proximity and bounding boxes.
GeoResult
A result from a geospatial query.
GraphStore
Simple graph data model for Rift. Supports nodes, edges, and basic traversal queries.
GSet<T>
G-Set (Grow-only set) - can only add elements. Merge is the union of both sets.
HashPartitionStrategy
Hash-based partitioning strategy.
HiveMigrationHelper
Migration helper for transitioning from Hive/hive_ce to Rift. Reads old Hive data files and converts them to Rift format automatically.
IncrementalExport
Represents an incremental export of changes.
IncrementalExporter
Incremental export support for Rift. Exports only changes since the last export for efficient sync/backup.
IndexHint
Suggestion for an index that would improve query performance.
IndexManager
Manages secondary indexes for Rift boxes.
InMemorySyncBackend
In-memory sync backend for testing. Stores all changes in memory and allows pulling them back.
IsolatedBox<E>
Isolated version of Box
IsolatedBoxBase<E>
Isolated version of BoxBase
IsolatedLazyBox<E>
Isolated version of LazyBox
IsolatedRiftInterface
Interface for IsolatedRift
IsolateNameServer
An abstraction of the IsolateNameServer
LazyBox<E>
LazyBoxes don't keep the values in memory like normal boxes. Each time a value is read, it is loaded from the backend.
LazyLoader<K, V>
Configurable lazy loading with strategies.
LazyRef<K, V>
A lazy-loaded reference to a value.
LazyRelation
A lazy-loaded relation that only fetches data when accessed.
LazyRelationAdapter
A lazy relation adapter that wraps a LazyRelation and provides a noSuchMethod-based proxy pattern for accessing related data.
ListChange<E>
Describes a single change in an ObservableList.
LiveQuery<E>
A live query that automatically re-executes when box data changes.
LoggingMiddleware
Built-in logging middleware that logs all box operations.
LRUCache<K, V>
LRU (Least Recently Used) cache for Rift lazy loading.
LWWMap<K, V>
LWW-Map (Last-Writer-Wins map) - a map where each key has an independent LWW-Register, so conflicts are resolved per-key.
LWWRegister<T>
LWW-Register (Last-Writer-Wins register) - single value with timestamp. When merging, the value with the later timestamp wins. Ties are broken by nodeId comparison for determinism.
MapChange<K, V>
Describes a single change in an ObservableMap.
MapCodec
Built-in codec for Map<String, dynamic> (passthrough).
MapProjection
A generic map-based projection that applies handler functions.
MapValuesTransform
Transforms the value of a specific field using a function.
MaskingRule
A rule defining how to mask a specific type of data.
MetricsReport
A report of all collected metrics.
MiddlewareChain
A chain of middleware that processes box operations.
MigrationReport
Report of a migration from Hive to Rift.
MigrationStep
A single migration step that transforms data from one schema version to the next.
Migrator
Schema migration framework for Rift.
MockBox<E>
Mock Box for unit testing without a real database. All data is stored in memory.
ObservableComputation<T>
A computed/derived value that automatically updates when its dependencies (observables) change.
ObservableList<E>
A reactive list that notifies listeners on any modification.
ObservableMap<K, V>
A reactive map that notifies listeners on any modification.
OperationMetric
Metrics for a single operation type.
ORSet<T>
OR-Set (Observed-Remove set) - supports add and remove with conflict resolution. Each add operation attaches a unique tag. Remove only removes tags that have been observed, so concurrent add and remove operations resolve in favor of add.
PartitionedBox
A virtual box that delegates to partition boxes.
PartitionStrategy
Abstract base class for partition strategies.
PatchOperation
A single patch operation (RFC 6902 JSON Patch).
PNCounter
PN-Counter (Positive-Negative counter) - can increment and decrement. Composed of two G-Counters: one for increments and one for decrements.
PoolConfig
Configuration for a connection pool.
PooledBox<E>
A boxed reference obtained from the pool.
PoolStats
Stats about the connection pool.
PrefetchStrategy<K, V>
Prefetch strategy for related data.
ProfilerReport
A performance report generated by the profiler.
Projection<T>
Abstract base class for projections.
QueryAnalysis
Description of a query to be optimized.
QueryOptimizer
Query optimizer that analyzes and optimizes queries.
QueryPlan
An optimized query execution plan.
QueryRewrite
A rewrite rule applied to a query.
RangePartitionStrategy
Range-based partitioning strategy.
RateLimiter
Token bucket rate limiter for Rift operations.
RateLimitManager
Manages rate limiters per box and globally.
RateLimitPolicy
Configuration for rate limiting behavior.
ReadCache<K, V>
Read cache with LRU and LFU eviction strategies and optional TTL.
RecordAdapter
Adapter for Dart 3 Record types. Automatically serializes Record values without manual TypeAdapters.
ReflectiveCodec<T>
Codec for simple objects using field definitions.
RelationConfig
Configuration for a relation between two boxes.
RelationIndex
Internal index for tracking relations efficiently.
RelationManager
Manages relations between Rift boxes.
RenameFieldTransform
Renames a field from oldName to newName.
ReplicaNode
Represents a replica node in the replication topology.
ReplicationConflict
Represents a replication conflict between two versions.
ReplicationEvent
A replication event.
ReplicationManager
Manages replication between Rift instances.
RiftAesCipher
Default encryption algorithm. Uses AES256 CBC with PKCS7 padding.
RiftBinaryStorage
Binary storage for large objects (images, PDFs, audio). Stores binary data with metadata, lazy loading, and optional encryption.
RiftBoxCubit<T>
Bloc/Cubit integration for Rift boxes. Provides base classes for creating Bloc-compatible state from Rift boxes.
RiftBoxProviderConfig<T>
Riverpod integration for Rift boxes. Provides providers that automatically update when box data changes.
RiftCipher
Abstract cipher can be implemented to customize encryption.
RiftCLI
Rift CLI tool for database inspection and management.
RiftCodec<T>
No-codegen mode for Rift - simple codec-based serialization. Allows using Rift without build_runner/code generation for simple use cases. A codec that serializes/deserializes objects to/from maps.
RiftCollection<E extends RiftObjectMixin>
List containing RiftObjectMixins.
RiftCompression
Compression configuration for Rift boxes.
RiftCrossField
Annotate a field with cross-field validation.
RiftCursor<K, V>
Cursor-based iterator for Rift boxes.
RiftEnhancedCipher
Enhanced encryption cipher with modern security features.
RiftField
Annotate all fields you want to persist with RiftField.
RiftForm
A reactive form group with validation and auto-save.
RiftFormField<T>
A reactive form field bound to a box key.
RiftInterface
The main API interface of Rift. Available through the Rift constant.
RiftList<E extends RiftObjectMixin>
Allows defining references to other RiftObjectMixins.
RiftMetrics
Singleton metrics collector for Rift operations.
RiftMiddleware
Middleware can intercept and modify database operations.
RiftObject
TODO: Document this!
RiftObservable<T>
A reactive observable that wraps a value and notifies listeners on change.
RiftOperation
Represents a Rift database operation.
RiftPlugin
Plugin architecture for Rift. Allows the community to build features on top of the library. Abstract base class for Rift plugins.
RiftPluginContext
Context provided to a plugin when it is registered.
RiftPluginManager
Manages registered plugins and dispatches notifications.
RiftPool
Connection pool for Rift boxes.
RiftProfiler
Performance profiler for Rift database operations. Tracks timing, memory, and throughput metrics.
RiftQuery<E>
Fluent query builder for Rift boxes.
RiftRiverpodHelper
Helper to create Riverpod-compatible notifiers for Rift boxes.
RiftSignal<T>
Reactive signals integration for Rift. Creates reactive signals from box values that auto-update on data changes.
RiftSignalFactory
Factory for creating signals from Rift boxes.
RiftSync
RiftSync - main sync manager. Coordinates synchronization between local boxes and a remote backend.
RiftTestUtil
Testing utilities for Rift database. Makes it easy to write unit and integration tests.
RiftTransaction
Represents an ACID transaction that can be committed or rolled back.
RiftType
Annotate classes with RiftType to generate a TypeAdapter.
RiftValidation
Annotate a field with validation rules.
RiftValidationRule
A validation rule for code generation.
RiftValidationSchema
Annotate a Rift type with validation schema.
Role
A named set of permissions.
SanitizationResult
Result of sanitizing data.
SanitizationRule
A single sanitization rule.
SchemaValidator
Validates data against a DataValidationSchema.
SchemaVersionTracker
Tracks schema version per box.
SecondaryIndex
A secondary index on a single field of a Rift box.
SlowQueryEntry
A record in the slow query log.
SnapshotChange
A change between two snapshots.
SnapshotDiff
Computes the diff between two snapshots.
SnapshotIsolation
Creates and manages snapshots for Rift boxes.
SortCondition
A sort condition for a query.
SyncBackend
Abstract interface for sync backends. Implement this to connect Rift to any backend (Supabase, Firebase, REST, WebSocket).
SyncChange
A single change to be synced.
SyncConfig
Configuration for a sync connection.
SyncConflict
A conflict between local and remote changes.
SyncCursor
A cursor that tracks the position in the sync stream.
SyncEvent
A real-time event from the sync backend.
SyncResult
Result of a push operation.
TimeOfDayAdapter
TimeSeries
Time-series data storage and querying for Rift. Optimized for timestamped data with downsampling and aggregation.
TimeSeriesPoint
A single data point in a time series.
TimeTravel
Time travel capability for Rift boxes. Allows reverting to any previous state via event sourcing.
TimeTravelEvent
A single recorded event in the time travel log.
TransactionManager
Manages ACID transactions across Rift boxes.
TransformPipeline
A pipeline of transforms applied in sequence.
TTLManager
Manages TTL (Time-To-Live) for box entries.
TTLStorage
Stores TTL metadata in a special internal box __rift_ttl__.
TypeAdapter<T>
Type adapters can be implemented to support non primitive values.
TypeConvertTransform
Converts the type of a specific field.
TypedBox<T>
A typed box wrapper that automatically serializes/deserializes using codecs.
TypeRegistry
TypeRegistries contain the TypeAdapters associated with a typeId.
ValidationError
A validation error for a specific field.
ValidationMiddleware
Built-in schema validation middleware.
ValidationResult
Result of validating data against a schema.
ValidationRule
Field validation rule.
ValidationRules
Pre-built validation rules for common use cases.
ValidationSchema
Schema definition for a box.
VectorSearch
Vector similarity search for AI/embedding applications. Uses brute-force search for small datasets with HNSW support for large ones.
VectorSearchResult
A single result from a vector search.
VersionDiff
Represents the diff between two entry versions.
VersionManager
Manages entry versions per box.
WatchBoxBuilder
A general-purpose widget which rebuilds itself when the box or a specific key change.

Enums

AdaptiveCacheStrategy
Cache eviction strategies for AdaptiveCache.
AggregationMethod
Aggregation methods for downsampling time-series data.
AggregationOpType
Aggregation operation type.
AuditAction
Audit action types.
CacheStrategy
Read cache layer for Rift storage backend. Supports LRU and LFU eviction strategies with optional TTL.
CDCEventType
Type of CDC event.
ChangeType
Type of change operation.
CompressionAlgorithm
Compression algorithm selector.
ConflictResolution
Strategy for resolving sync conflicts.
ConflictResolutionStrategy
Strategies for resolving replication conflicts.
Direction
Direction for graph traversal.
DistanceMetric
Distance metric used for vector similarity computation.
EncryptionAlgorithm
Encryption algorithms supported for field-level encryption.
FieldRuleType
Types of field validation rules.
FilterOperator
Operators supported by filter conditions.
FormState
Form state representing the overall state of a RiftForm.
FTSSearchOperator
Operator for combining search terms in a full-text search query.
IndexOperator
Operators for index queries.
IndexType
Index type determines the underlying data structure and query capabilities.
LazyStrategy
Strategies for lazy loading data.
ListChangeType
Type of change that occurred in an ObservableList.
LogLevel
Log level for the logging middleware.
MapChangeType
Type of change that occurred in an ObservableMap.
MaskingStrategy
Strategies for masking data.
OperationType
The type of database operation being measured.
PartitionStrategyType
Strategy for partitioning data.
PatchOperationType
Types of patch operations.
Permission
Permissions for box operations.
QueryRewriteType
Types of query rewrites.
RelationType
The type of relation between two boxes.
ReplicaRole
Role of a replica node.
ReplicaStatus
Status of a replica node.
ReplicationEventType
Types of replication events.
ReplicationMode
Replication mode.
RiftStorageBackendPreference
declares the preferred JS StorageBackend to be used
SanitizationRuleType
Types of sanitization rules.
SnapshotChangeType
The type of change between snapshots.
SortOrder
Sort order direction.
SyncEventType
Types of sync events.
SyncStatus
Current status of the sync connection.
TimeTravelEventType
Type of time travel event.
TransformPhase
When to apply a transform.
ValidationRuleType
Types of validation rules for code generation.

Mixins

RiftObjectMixin
Extend RiftObject to add useful methods to the objects you want to store in Rift

Extensions

BoxX on Box<T>
Flutter extensions for boxes.
IsolatedRiftX on IsolatedRiftInterface
Flutter extensions for IsolatedRiftInterface
LazyBoxX on LazyBox<T>
Flutter extensions for lazy boxes.
RiftX on RiftInterface
Flutter extensions for Rift.

Constants

schemaVersionKey → const String
The special key used to store the schema version in each box.
ttlBoxName → const String
The name of the special internal box used to store TTL metadata.

Properties

globalIndexManager IndexManager
Global singleton index manager shared across all Rift boxes.
final
Hive RiftInterface
Backward compatibility alias for Rift
final
IsolatedHive IsolatedRiftInterface
Backward compatibility alias for IsolatedRift
final
IsolatedRift IsolatedRiftInterface
Global constant to access IsolatedRift
final
Rift RiftInterface
Global constant to access Rift
final

Functions

defaultFieldValueExtractor(dynamic value, String field) → dynamic
Default field value extractor.

Typedefs

BoxWidgetBuilder<T> = Widget Function(BuildContext context, Box<T> box)
Signature for a function that builds a widget given a Box.
CompactionStrategy = bool Function(int entries, int deletedEntries)
A function which decides when to compact a box.
CustomMaskingFunction = String Function(String input)
A function type for custom masking logic.
FieldValueExtractor = dynamic Function(dynamic value, String field)
Callback type for extracting a field value from a stored object.
HiveLogger = Logger
Backward compatibility alias for RiftLogger
HiveLoggerLevel = LoggerLevel
Backward compatibility alias for RiftLoggerLevel
KeyComparator = int Function(dynamic key1, dynamic key2)
RiftLogger = Logger
Rift's logger
RiftLoggerLevel = LoggerLevel
Rift's logger level

Exceptions / Errors

AccessDeniedException
Exception thrown when access is denied.
PatchException
Exception thrown when a patch cannot be applied.
RateLimitExceeded
Exception thrown when rate limit is exceeded.
RiftError
An error related to Rift.
ValidationException
Exception thrown when validation fails.