composable_architecture_flutterw library
Flutter bindings for the Composable Architecture.
Re-exports everything from composable_architecture_core and adds
Flutter-specific widgets for connecting stores to the widget tree.
Widgets
- WithStore - Connects a Store to the widget tree with reactive rebuilds.
- ForEachStore - Renders a collection with per-item scoped stores.
- IfLetStore - Conditionally renders based on nullable state.
- SwitchStore - Renders based on the runtime type of state.
Utilities
- IsEqualUtils - Equality helpers for controlling rebuilds.
- IterableBuilder - Layout factories for ForEachStore.
- DependencyProvider / Dependency - Dependency injection.
- TextEditingControllerBuilder - Two-way text field binding.
App Builders
For Material or Cupertino app integration with platform event handling, import the sub-libraries:
import 'package:composable_architecture_flutterw/material.dart';
import 'package:composable_architecture_flutterw/cupertino.dart';
Classes
-
CancelEffect<
Value> - An effect that cancels a previously registered in-flight effect by ID. See Effect.cancel.
-
CancellableEffect<
Value> - An effect that associates the wrapped effect with an EffectID for cancellation management. See Effect.cancellable.
-
ConcatenatedEffect<
Value> - An effect that runs multiple effects sequentially. See Effect.concatenate.
-
CurrentValueSubject<
T> - An Observable that holds a current value and notifies listeners when the value changes.
-
DelayEffect<
Value, Time, Interval> - An effect that delays execution by an interval before running the wrapped effect. See Effect.delay.
- Dependency
- An InheritedWidget that provides a DependencyProvider to the widget tree.
-
DependencyProvider<
AppState, AppAction, AppEnvironment> - A type-based service locator for dependency injection.
-
Effect<
Value> - Describes a unit of work that can emit values, be cancelled, or compose with other units to form more elaborate workflows.
-
FireAndForgetEffect<
Value> - An effect that runs the wrapped effect but suppresses all emissions. See Effect.fireAndForget.
-
FlatMappedEffect<
Value, PrevValue> - An effect that flat-maps emitted values into new effects. See Effect.flatMap.
-
ForEachStore<
ID, GlobalState, GlobalAction, ItemState, ItemAction> - A widget that renders each element of a collection with its own scoped Store.
-
FutureEffect<
Value> - An effect that wraps an asynchronous computation. See Effect.task.
-
IfLetStore<
S, A> - A widget that conditionally renders content based on nullable state.
- IsEqualUtils
- Utility functions for comparing state values to determine whether a widget rebuild is necessary.
- IterableBuilder
- Factory functions that create layout widgets for ForEachStore.
-
Listener<
T> - Internal listener entry pairing a callback with a subscription ID.
-
MappedEffect<
Value, PrevValue> - An effect that transforms emitted values through a mapping function. See Effect.map.
-
MergedEffect<
Value> - An effect that runs multiple effects concurrently. See Effect.merge.
-
NoneEffect<
Value> - An effect that performs no work. See Effect.none.
-
Observable<
T> - A lightweight reactive primitive for observing value changes.
-
Reducer<
State, Action, Environment> - A pure function that processes an action against the current state and returns the new state along with any Effects to execute.
-
RunEffect<
Value> - An effect that runs a synchronous computation and emits the result. See Effect.run.
-
Store<
S, A> - The runtime that holds application state, processes actions through a Reducer, and executes Effects.
-
StreamEffect<
Value> - An effect that bridges a Dart Stream into the effect system. See Effect.stream.
- SubjectOptions
- Configuration options for creating a CurrentValueSubject.
-
SwitchStore<
S, A> - A widget that renders different content based on the runtime type of the store's state.
- TCAAction
- TCARoute
- TCAState
-
TestStore<
State, Action, Environment> - A testing wrapper around Store that records all dispatched actions and state changes for easy assertions.
- TextEditingAction
- Actions emitted by a TextEditingControllerBuilder in response to text input events.
- TextEditingActionEdit
- Text content changed. See TextEditingAction.edit.
- TextEditingActionOnFocusChange
- Focus changed. See TextEditingAction.onFocusChange.
- TextEditingActionOnKeyEvent
- Key event occurred. See TextEditingAction.onKeyEvent.
-
TextEditingControllerBuilder<
S, A> - A stateful widget that manages a TextEditingController and FocusNode with two-way binding to a Store.
-
ValueEffect<
Value> - An effect that synchronously emits a single value. See Effect.value.
-
WithStore<
S, A> - The primary widget for connecting a Store to the Flutter widget tree.
Enums
- ThrottleDirection
- Controls whether Effect.throttle emits on the leading or trailing edge of the throttle interval.
Extensions
-
ForEachIterableReducer
on Reducer<
State, Action, Environment> -
Extension providing
forEachvariants for applying a reducer to each element in a collection.
Properties
-
textEditingReducer
→ Reducer<
String, TextEditingAction, EmptyEnvironment> -
A pre-built reducer for simple text state managed by a
TextEditingControllerBuilder.
final
Functions
-
deletedIds<
ID, E> (Iterable< E> previous, Iterable<E> current, ID toID(int index, E element)) → Iterable<ID> -
Returns the IDs present in
previousbut not incurrent. -
fromSubscription(
StreamSubscription< void> subscription, {bool? cancelOnError}) → CancelableOperation<void>
Typedefs
-
ActionLens<
GlobalAction, LocalAction> = ({GlobalAction Function(LocalAction localAction) embed, LocalAction? Function(GlobalAction action) extract}) -
A bidirectional accessor for filtering and embedding a
LocalActionwithin aGlobalAction. - DisposeCallback = void Function({EffectID? id, bool shouldCancel})
- Callback invoked to dispose of or cancel a registered effect.
-
EffectHandler<
Value> = ({DisposeCallback dispose, EmitCallback< Value> emit, GuardCallback guard, RegisterCallback register}) - The handler record provided to Effect.run that connects the effect to the store's action dispatch, cancellation, and lifecycle systems.
- EffectID = String
- Unique string identifier for cancellable effects.
-
EmitCallback<
Value> = void Function(Value value) -
Callback invoked to emit a
valuefrom an effect back to the store. - EmptyEnvironment = void
- Type alias for reducers that do not require an environment.
- GuardCallback = bool Function({EffectID? id})
- Callback that checks whether an effect should still emit.
-
Lens<
GlobalState, LocalState> = ({LocalState Function(GlobalState state) get, GlobalState Function(GlobalState state, LocalState localState) set}) -
A bidirectional accessor for reading and writing a
LocalStatewithin aGlobalState. -
OnChangeCallback<
T> = void Function(T value) - Callback invoked when an Observable emits a new value.
-
Prism<
GlobalAction, LocalAction, ID> = ({GlobalAction Function(ID id, LocalAction localAction) embed, (ID, LocalAction)? Function(GlobalAction action) extract}) -
A keyed variant of ActionLens for routing actions to elements in a
collection by
ID. - RegisterCallback = void Function(CancelableOperation cancellable, {bool cancelInFlight, EffectID? id})
-
Callback invoked to register a
CancelableOperationwith the store's effect lifecycle manager. -
RouteLens<
GlobalState, RouteState, LocalState> = ({LocalState Function(GlobalState global, RouteState route) get, (GlobalState, RouteState) Function(GlobalState global, RouteState route, LocalState local) set}) -
A lens that operates on state composed from both a
GlobalStateand aRouteState. -
TextEditingControllerWithStoreBuilder<
S, A> = Widget Function(S state, void send(A action), BuildContext context, TextEditingController controller, FocusNode focusNode) - Builder function for WithStore.textEditingController variants.