Skip to content

async_job and solo

Cancellation, child tasks and cleanup for asynchronous Dart, and a controller built on them that runs one job at a time over its state.

Cancelling async work. A Future in Dart cannot be cancelled. async_job adds cancellation, child tasks and cleanup to asynchronous code: a cancelled job stops at its next checkpoint, runs its cleanup and ends after its children. It needs no controller and no Flutter: it runs on a server, in a CLI, or under a riverpod provider or a bloc handler, as With riverpod and bloc shows.

State with a lifecycle. solo is a controller over one immutable state that runs jobs over it one at a time, with policies for a second call and rules for the states a job may run in; flutter_solo brings it to widgets. solo and bloc, side by side puts eleven controller scenarios in both packages.

Package What it is
async_job Cancellation, child tasks and cleanup for one asynchronous operation. Pure Dart, depends only on meta.
solo The controller over async_job: a queue with policies, state rules, children, accumulation. Pure Dart.
flutter_solo The Flutter face of solo: SoloBuilder, ValueListenable, select, listen.
async_job_lints An analyzer plugin that reports the common mistakes in code on async_job.
solo_lints The analyzer plugin for code on solo: the rules of async_job_lints and those of the controller.

solo re-exports async_job, and flutter_solo re-exports solo, so one dependency is enough: async_job when cancellation is all you need, solo or flutter_solo when you need a controller. The two plugins are not dependencies: one of them is named in analysis_options.yaml, async_job_lints for code on async_job, or solo_lints, which includes its rules, for code on solo.