Skip to content

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.

“Stop writing isLoading manually.”

  • 🛡️ Enterprise Grade: Built for resilience. Includes Circuit Breakers and Offline Queues out of the box.
  • ⚡ Zero Friction: QueryClient is auto-injected. It feels just like using a standard Cubit, 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 dynamic guessing.

Add the adapter and Bloc to your project:

Terminal window
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.

ComponentDescription
FasqBlocProviderThe root widget that sets everything up.
QueryCubitA Cubit that fetches and caches data.
MutationCubitA Cubit for creating/updating/deleting data.
InfiniteQueryCubitSpecialized Cubit for infinite lists/feeds.
CompositionMixin to combine multiple queries in one Bloc.
  1. Setup: Wrap your app with FasqBlocProvider.
  2. Create: Extend QueryCubit for your data.
  3. Consume: Use BlocBuilder to show loading, error, or data states.

Check out the Examples to see it in action!