qora 0.2.0
qora: ^0.2.0 copied to clipboard
A powerful async state management library for Dart, inspired by TanStack Query
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
Unreleased #
0.2.0 - 2026-02-22 #
Added #
watchState<T>(Object key)— observe-only stream that subscribes to a query's state without triggering any fetch; ideal for derived UI components (e.g. badges, avatar widgets)prefetch<T>()— pre-warm the cache before navigation without blocking the UI; no-op if data is already freshrestoreQueryData<T>(key, snapshot)— roll back an optimistic update; removes the entry from cache if snapshot isnullremoveQuery(key)— evict a single query from cache and cancel any pending request for itclear()— evict all cached queries and cancel all in-flight requests (e.g. on user logout)cachedKeysgetter — returns all currently cached normalised query keys for debugging or bulk operationsdebugInfo()— returns a map snapshot of cache and pending-request counts
Changed #
QoraState<T>rewritten as a sealed class — four exhaustive variants:Initial | Loading | Success | Failure.LoadingandFailurenow carrypreviousDatafor graceful degradation (stale data shown during refetch or on error)- Polymorphic key system —
fetchQuery,watchQuery,watchState,prefetch,setQueryData,restoreQueryData,invalidate,getQueryData, andgetQueryStatenow acceptObject(plainList<dynamic>orQoraKey); keys are normalised and compared with deep structural equality KeyCacheMap— custom map implementation with deep recursive equality and order-independent map-key comparison; eliminates reference-equality bugsinvalidate(key)replaces the oldinvalidateQuery(key)invalidateWhere(predicate)replaces the oldinvalidateQueries(predicate); predicate receives the normalisedList<dynamic>key- Package structure reorganised — source files split into
cache/,config/,client/,key/,state/, andutils/subdirectories for clarity
Fixed #
- Defensive immutability: normalised key lists are wrapped in
List.unmodifiable()to prevent accidental mutation by callers