Package selection guidance compiled from public package information, community data, and project usage.
command_it is a state management solution built on `ValueListenable` and the Command design pattern, offering a clean, reactive way to handle state changes in Flutter apps. Originally known as flutter_command, it provides a structured approach to managing asynchronous operations and state updates. The package promotes separation of concerns by encapsulating actions within commands, making code more testable and maintainable. It integrates seamlessly with Flutter’s reactive framework and supports all major platforms.
Use cases
Managing async operations like API calls
Handling form submissions
Implementing undo/redo functionality
Coordinating state changes across multiple widgets
Building reusable business logic layers
Key features
Reactive state via ValueListenable
Command pattern for encapsulated actions
Built-in support for loading, error, and success states
Easy integration with Flutter's widget tree
Cross-platform compatibility
Suitable for
Developers seeking a lightweight state management alternative
Teams wanting clear separation between UI and business logic
Projects requiring predictable state transitions
Apps with frequent async operations
Test-driven development workflows
Considerations
May require learning curve for new users unfamiliar with the Command pattern
Less suitable for very simple state needs
Limited ecosystem compared to larger state management solutions
Best paired with other tools for full app architecture
Original README
Original README snapshot from the linked source repository. Visit the repository for the latest content.
Command pattern for Flutter - wrap functions as observable objects with automatic state management
Commands replace async methods with reactive alternatives. Wrap your functions, get automatic loading states, error handling, and UI integration. No manual state tracking, no try/catch everywhere.
Call them like functions. React to their state. Simple as that.
Part of flutter_it — A construction set of independent packages. command_it works standalone or combines with watch_it for reactive UI updates.
Why Commands?
🎯 Declarative — Wrap functions, get observable execution state automatically
⚡ Automatic State — isRunning, value, errors tracked without manual code
🛡️ Smart Error Handling — Route errors globally/locally with filters
Chain commands together with the pipeToCommand() extension. When the source completes successfully, it automatically triggers the target command:
// Trigger refresh after save completes
saveCommand.pipeToCommand(refreshCommand);
// Transform result before passing to target
userIdCommand.pipeToCommand(fetchUserCommand, transform: (id) => UserRequest(id));
// Pipe from any ValueListenable - track execution state changes
longRunningCommand.isRunning.pipeToCommand(spinnerStateCommand);
The pipeToCommand() extension works on any ValueListenable, including commands, isRunning, results, or plain ValueNotifier. Returns a ListenableSubscription for manual cancellation if needed.
⚠️ Warning: Circular pipes (A→B→A) cause infinite loops. Ensure your pipe graph is acyclic.
Ecosystem Integration
Built on listen_it — Commands are ValueListenable objects, so they work with all listen_it operators (map, debounce, where, etc.).
// Register with get_it
di.registerLazySingleton(() => TodoManager());
// Use commands in your managersclassTodoManager{
final loadTodosCommand = Command.createAsyncNoParam<List<Todo>>(
() => api.fetchTodos(),
[],
);
// Debounce search with listen_it operatorsfinal searchCommand = Command.createSync<String, String>((s) => s, '');
TodoManager() {
searchCommand.debounce(Duration(milliseconds: 500)).listen((term, _) {
loadTodosCommand.run();
});
}
}
Want more? Combine with other flutter_it packages:
listen_it — Required dependency. ValueListenable operators and reactive collections.
Optional: watch_it — State management. Watch commands reactively without builders: watchValue((m) => m.loadCommand).
Optional: get_it — Service locator for dependency injection. Access managers with commands from anywhere: di<TodoManager>().
💡 flutter_it is a construction set — command_it works standalone. Add watch_it and get_it when you need reactive UI and dependency injection.
This package ships an Agent Skill for AI coding assistants
(Claude Code, Cursor, GitHub Copilot, Codex, Gemini CLI and others) in skills/command-it-expert/.
It teaches them the critical rules, common patterns and anti-patterns of command_it.
Install it into your project with the official Dart skills tool:
dart run skills@ get
For the ecosystem-wide skills (architecture guidance, feed/data-source patterns, overview)
and the skills of the other flutter_it packages run: