testing library
Declarative testing utilities and harness for flutter_commander.
Import this library in your unit and widget tests:
import 'package:flutter_commander/testing.dart';
import 'package:flutter_test/flutter_test.dart';
Classes
- CancellationToken
- Collaborative token used to signal cancellation across asynchronous tasks.
- ClearHistoryIntent
- Command intent to clear the undo and redo history stacks in a commander equipped with UndoRedoMixin.
-
Command<
I extends CommandIntent, S, E> -
Base class for all business logic commands in
flutter_commander. -
Commander<
S, E> -
The core reactive orchestrator in
flutter_commander. -
CommanderBuilder<
C extends Commander< S, dynamic> , S, R> - Rebuilds widget subtrees reactively based on a Commander's state.
-
CommanderListener<
C extends Commander< dynamic, E> , E> -
Listens exclusively to one-shot side effect emissions of type
Efrom a Commander without rebuilding the widget tree. - CommanderObserver
- Global observer for monitoring lifecycle events, executions, state mutations, side-effects, and unhandled errors across all Commander instances in an application.
-
CommanderScope<
C extends Commander> - Injects and manages the lifecycle of a Commander in the widget tree.
-
CommanderSelector<
C extends Commander< S, dynamic> , S, R> -
Rebuilds widget subtrees reactively based on a selected slice
Rof stateS. -
CommanderStateBuilder<
C extends Commander< S, dynamic> , S> -
Rebuilds widget subtrees reactively based on a Commander's full state
S. -
CommanderView<
C extends Commander< S, E> , S, E> -
A clean, declarative base widget for building full screens and features in
flutter_commander. - CommandIntent
- Base marker interface for all user or system intents.
- CommandInterceptor
- Interceptor interface for cross-cutting observability, telemetry, and debugging.
-
CommandScope<
S, E> - Context provided to a Command during its execution lifecycle.
- InMemorySavedStateStore
- An in-memory implementation of SavedStateStore.
- LoggingCommandInterceptor
-
Default structured console logger for
flutter_commander. - RedoIntent
- Command intent to redo one or more previously undone state transitions in a commander equipped with UndoRedoMixin.
- SavedStateHandle
-
A key-value container for preserving and restoring granular state properties,
inspired by Android Jetpack's
SavedStateHandle. - SavedStateStore
- An abstract storage contract for persisting and restoring state.
-
TestCommandScope<
S, E> - A deterministic, widget-free test harness for executing and verifying Command units.
- UndoIntent
- Command intent to undo one or more previous state transitions in a commander equipped with UndoRedoMixin.
Enums
- ExecutionPolicy
- Defines how a Command handles concurrent or rapid successive invocations.
Mixins
-
SavedStateMixin<
S, E> - A mixin that adds automatic state persistence and restoration to a Commander, inspired by native mobile saved state restoration architectures.
-
UndoRedoMixin<
S, E> - A mixin that adds undo/redo (time-travel) state management to any Commander.
Extensions
- CommanderBuildContextX on BuildContext
-
Clean ergonomic extension methods on BuildContext for
flutter_commander.
Functions
-
commanderTest<
C extends Commander< (S, E> , S, E>String description, {FutureOr< void> setUp()?, required FutureOr<C> build(), FutureOr<S> seed()?, FutureOr<void> act(C commander)?, Duration? wait, int skip = 0, dynamic expect()?, dynamic expectStates()?, dynamic expectEffects()?, dynamic errors()?, FutureOr<void> verify(C commander)?, FutureOr<void> tearDown(C commander)?, dynamic tags, dynamic skipTest, Timeout? timeout}) → void - A declarative test harness for testing Commander orchestrators.
Exceptions / Errors
- CancellationException
- Exception thrown when a collaborative operation checks CancellationToken.throwIfCancelled after the token has been cancelled.
- UnregisteredIntentException
- Thrown when a CommandIntent is dispatched without any matching registered Command.