flutter_solo 0.5.0
flutter_solo: ^0.5.0 copied to clipboard
State management for Flutter: sequential jobs, exclusive state ownership, cooperative cancellation, rebuilds through SoloBuilder or ValueListenable.
0.5.0 #
This package re-exports solo and, through it, async_job, so their changes
are its own: see
the solo changelog
and
the async_job changelog.
0.4.0 #
This package re-exports solo and, through it, async_job, so their changes
are its own: see
the solo changelog
and
the async_job changelog.
0.3.0 #
This package re-exports solo and, through it, async_job, so their changes
are its own: see
the solo changelog
and
the async_job changelog.
Breaking changes #
Solo.onErroris a notice insolo, and the newSolo.onUnansweredanswers for an error nobody else has: one no outcome carries, and aFailednobody observes. SettingSolo.observer, or overridingonErrorwithout callingsuper, no longer keeps such an error out of the zone: see the same entry of thesolochangelog.Job.ignore()is renamed toJob.ignoreFailure()inasync_job.- In
solo,Solo.runis renamed toenqueue, andSolo.addtoenqueueJob. See the same entry of thesolochangelog. - The state handlers of
enqueueandjobare renamed insolo:onErrortoifFailed,onCanceltoifCancelled. ctx.runandctx.runAlltake aChildJobinasync_job, andsolo'sSoloJobis one: a helper that returnsjob(...)forctx.runis declaredSoloJob<T>, notJob<T>.SoloListenableis a mixin onSolo, the waysolo'sSoloStreamis:extends SoloListenable<S>becomesextends Solo<S> with SoloListenable. See The controller as aValueListenable.SoloListenableno longer carries a stream. A controller whosestreamsomebody reads mixes in both,with SoloStream, SoloListenable. See A controller with both deliveries.- In
solo, the controller's synchronous read iscurrentState, notstate. ValueListenableis no longer re-exported. A file that names the type importspackage:flutter/foundation.dart.closetakessolo's newSoloCloseMode.publishis no longer a public member of a controller withSoloListenable.- The listeners are dropped when the engine finishes closing, right after the
observer's
onCloseand the controller's own. Write the last state synchronously, in the controller'sonClose.
Deprecated #
ctx.waitinasync_jobis deprecated in favour ofctx.abandonableand goes away in the next release.
Changes you will see on upgrade #
- A listener that throws is reported through
FlutterError.reportError, the wayChangeNotifierreports one, and no longer throws out of theemitor theexternalSetStatethat made the change: the job whoseemitit was endsDonewhere it used to endFailed. - Errors that
0.2.0kept to the hooks reachSolo.unansweredHandleror the zone: see the same heading of thesolochangelog.
Added #
SoloBuilder: whatValueListenableBuilderis, for a controller that is not aValueListenable. See Usage.SoloSelection<S, T>: aValueListenableof one value picked out of another, notifying only when that value changes. For a controller that is not aValueListenable,SoloSelection.frommakes one. See Selecting one value.SoloSelector, the widget that picks for you: a controller, aselectorand abuilder.selectandlistenas methods, withSoloSubscriptionandSoloSubscriptions, in an import of their own,package:flutter_solo/listenable.dart. See Listening without keeping the callback and Methods from a second import.
Fixed #
- A listener that throws no longer cuts off the listeners behind it, and no
longer lets a job go on running against a state its
keepWhileforbids. - A listener added after the controller had finished closing is ignored: it is neither registered nor kept, and nothing is thrown. It used to be kept in memory for good.
- One pass of notifying is linear in the number of listeners; it was quadratic.
Documentation #
- The README's examples compile, and the page gained the sections on the
controller as a
ValueListenable, on selections and onlisten. - The package has guides of its own, Mixins and Testing.
- The example no longer sticks on a failed load.
0.2.0 #
The first published release. 0.1.0 never left the tree.
SoloListenable<S>: aSolo<S>that is also aValueListenable<S>, forValueListenableBuilder,ListenableBuilder,AnimatedBuilderandListenable.merge. Listeners are called synchronously, in subscription order, on every state change; thestreamofSolostill works and arrives a microtask later.- Read-only on purpose:
valueandstateare the same object, and there is no setter — the state belongs to the jobs. close()cancels what is running, drops every listener and stops notifying for good; nothing else closes the controller for you.- Re-exports
package:solo/solo.dart, which re-exportspackage:async_job/async_job.dart, soflutter_solois the only dependency an app adds and the only import it writes. - Floor:
solo: ^0.2.0, whose job kernel isasync_job: ^0.2.0with synchronousjob.whenCancelled(callback)registration.
0.1.0 #
Never published.