Introduction
Welcome to Fasq Bloc!
This adapter brings the power of Fasq (caching, deduplication, optimistic updates) to the world of Discord (Blocs, Cubits, Streams). It allows you to build data-driven apps with the architecture you already know and love.
Why Fasq Bloc?
Section titled “Why Fasq Bloc?”“Stop writing
isLoadingmanually.”
- 🛡️ Enterprise Grade: Built for resilience. Includes Circuit Breakers and Offline Queues out of the box.
- ⚡ Zero Friction:
QueryClientis auto-injected. It feels just like using a standardCubit, but with superpowers. - 🚀 Main-Thread Safe: Heavy JSON parsing is automatically offloaded to Isolates to keep your UI 120fps smooth.
- 🔒 Strictly Typed: End-to-end type safety from your API definition to your UI state. No
dynamicguessing.
Installation
Section titled “Installation”Add the adapter and Bloc to your project:
flutter pub add fasq_bloc flutter_bloc[!NOTE] This adapter is built on top of the fasq core package, which will be added automatically as a dependency.
Core Concepts
Section titled “Core Concepts”| Component | Description |
|---|---|
| FasqBlocProvider | The root widget that sets everything up. |
| QueryCubit | A Cubit that fetches and caches data. |
| MutationCubit | A Cubit for creating/updating/deleting data. |
| InfiniteQueryCubit | Specialized Cubit for infinite lists/feeds. |
| Composition | Mixin to combine multiple queries in one Bloc. |
Quick Start
Section titled “Quick Start”- Setup: Wrap your app with
FasqBlocProvider. - Create: Extend
QueryCubitfor your data. - Consume: Use
BlocBuilderto show loading, error, or data states.
Check out the Examples to see it in action!