solidart 3.0.0-dev.5
solidart: ^3.0.0-dev.5 copied to clipboard
A simple State Management solution for Dart applications inspired by SolidJS
3.0.0-dev.5 #
- CHORE: Require
alien_signals2.5.0 or later. Disposing aComputedwith child effects now stops those effects in reverse creation order, which can change the order in which their signals auto-dispose. When an effect stops itself during a rerun, it immediately unlinks dependencies it has yet to read in that run. Later reads in the stopped callback leave it unsubscribed. - FIX: Signal updates continue notifying observers and DevTools when an effect or observer throws. The first error is rethrown, and later errors go to the current
Zone(#212). - FIX: Reading a dependency-free
Computedwhile building a DevTools event no longer auto-disposes it. Normal reactive cleanup can still run when the read reevaluates a computed (#191). - FIX: A delayed effect keeps its old child effects subscribed until the rerun starts. A replacement child that reads a signal synchronously can keep that signal alive. Use Solidart's
batch()for batched writes (#209).
3.0.0-dev.4 #
- PERF: With history enabled, list slot writes (including
firstandlast),add,insert,removeAt, andremoveLastsave one undo step. So doSetSignal.addon a default set andMapSignal.[]=on a default map, when their type arguments match the signal's. Other sets (custom equality, identity, sorted, or aSetSignal<num>holding aSet<int>) keep the eager copy. For example, aMapSignal<num, num>that holds an<int, int>{}keeps the eager copy. AMapSignal.[]=that overwrites an existing key is lazy only when the key is an immutable value (String,numother than NaN,bool, an enum value ornull), because the caller can change a mutable key after the write. A NaN key or element is never lazy, because NaN is not equal to itself. The first history read builds the previous collection. Later reads reuse it. A listener added withaddListenerdoes not read the history, so it does not build it. Other map types keep the eager copy to preserve their key semantics. A point write that partially changes the collection and throws notifies once and drops its history. With history on, a failed list resize is now detected by checking the slot at its index, not by comparing a full copy, so a custom backing list that moves elements and then throws can be missed when that slot keeps an identical value (#208). Built-in lists throw before they write. Writing directly to the backing collection before reading history can change the reconstructed value. Building the previous value at the first history read can throw (for example a map key's throwinghashCode, or acast()view that holds an entry of another type). Then that read throws,observe()does not call its listener for that change, and the write itself is kept (#210). A lazy write that triggers another write through the signal (for example from a custom backing collection) notifies once and keeps no previous value.
3.0.0-dev.3 #
- FEAT:
Signal,ReadableSignal,Computed,Resource, and the collection signals now implementpackage:listen'sValueListenable/ValueNotifiernatively in pure Dart, exposingaddListener/removeListener(plushasListeners/notifyListenerson the mutable signals). Listeners participate in auto-disposal: adding one keeps the signal alive, and removing the last one lets anautoDisposesignal dispose itself. Listeners followChangeNotifierregistration and error semantics: eachaddListenercall is a separate registration, and listener errors go toListenable.onError. AComputedselector error is not a listener error: it is thrown to the code that triggers the computation, includingaddListener(). Listeners differ fromChangeNotifierin some ways, including: a listener is not notified of its own write; writes insidebatch()notify at most once, at the end of the batch;addListener()on a disposed signal is a no-op (ChangeNotifierthrows in debug mode); and anotifyListeners()call made from inside a listener does not call that listener again. In that case, listeners that have not run yet in the current notification run once, and other listeners that already ran are called again.notifyListeners()reaches every dependent of the signal: effects and listeners rerun. A computed that a listener or effect depends on recomputes when notifications run (at the end of the batch, if one is active), and notifies them only if its value changed. Any other computed recomputes on its next read. TheReadSignaltype is also aValueListenable. - FIX: A
Computedwhose selector throws now recovers when one of its dependencies changes, also when its first evaluation throws (#183). An effect that reads aComputedkeeps running after theComputedthrows and recovers (#192). The error is thrown where the effect reads theComputed, so the effect'sonErrorcan handle it. A comparator that throws no longer breaks theComputed: the new value is kept, subscribers are notified, and the error is reported to the currentZoneinstead of being thrown to the code that triggered the update. - BREAKING:
solidartrequires Dart 3.13 or later andalien_signals2.4.0 or later.Computednow uses the error caching ofalien_signals. - FIX: An
autoDisposeComputedwhose evaluation throws now disposes itsautoDisposedependencies when it is disposed (#200). A nullableComputedno longer reports a previous value after its first evaluation returnsnull(#201). - FIX: Assigning a new collection to
ListSignal.value,MapSignal.valueorSetSignal.valuenotifies observers and effects once instead of twice, likeSignal. A listener that assigns the collection again during that notification no longer leavesvalueanduntrackedValueout of sync. Assigning aMapSignalorSetSignalinside an effect no longer makes the effect depend on it. - FIX:
observe()andaddListener()on a lazy signal that has no value yet no longer throw aStateError. The listener is called on the first assignment. The first assignment of a lazy signal no longer reports the new value as the previous value. Disposing a lazy signal that has no value no longer throws when DevTools are enabled. Reading a lazyResourceafter it is disposed no longer starts its fetcher or stream. - FIX: Reading a
Resourcefor the first time inside an effect (Effect,observe(),SignalBuilder) no longer makes that effect depend on the signals the fetcher reads. A streamResourcewith asourcekeeps following the source after its first event when it is first read inside an effect. - FIX: When the first run of an
Effectthrows and there is noonError, the effect is now disposed before the error is rethrown. This is the first run that happens when the effect is created (the defaultautorun). It does not apply to an effect created withautorun: falsethat you run later by hand. Before, the effect stayed subscribed to the signals it read, but the caller never got the handle to dispose it. So a failedobserve()oraddListener()no longer leaves a subscriber that cannot be removed (#183). If disposal itself throws, the caller still gets the original error, and the disposal error goes to the currentZone. This also applies inside abatch(). AnEffectwithonErroris unchanged whenonErrorreturns normally. IfonErrorthrows during that first run, the effect is now also disposed and the error fromonErroris rethrown. - FIX: An
Effectwhose first run throws is now disposed before the effects queued by that run, so it cannot run again. An error from a queued effect no longer replaces the error of that run (#197). An effect created withautorun: falseor withdelaystays alive after a failed run, because you already have it and can dispose it. Disposing an effect now also disposes the effects created inside it, and a disposeddelayeffect cancels its pending run (#198). Adelayeffect withautoDispose: truenow runs its first callback before it checks for auto-disposal (#203). Adelayeffect now tracks the signals its callback reads and reruns after the delay when one of them changes. Changes made while a rerun is pending join that rerun (#204). Known limitation (#209): the rerun that starts the timer disposes the effects created by the callback, and anautoDisposesignal that only they read, before the timer creates them again. A nested effect stopped by its parent now also offers auto-disposal to its dependencies (#202). The offer waits until the work that stopped it has finished: the outermost batch, flush orComputedevaluation, or the top-leveldispose(). So a parent effect orComputedthat recreates a child reading the sameautoDisposesignal keeps that signal alive. A disposedComputedoffers auto-disposal to its dependencies in the same way, also when its ownautoDisposeis false, after itsonDisposecallbacks, so they can subscribe to the dependencies of its child effects. The offer stops while effects queued by anonDisposecallback run. A disposed effect no longer keeps references to the signals it read. A live effect no longer keeps a reference to a disposed signal, and aComputedno longer keeps references to the signals it stopped reading. When anonDisposecallback or aSolidartObserver.didDisposeSignalthrows, disposal now still visits every dependency, callback and observer, then rethrows the first error. Later errors go to the currentZone(#199).Resource.dispose()also finishes and runs itsonDisposecallbacks when the disposal of itssourcethrows. Disposing aComputednow notifies observers once. When the callback ofbatch()or a manualEffect.run()throws, the caller now gets that error. Errors from the effects and disposals at the end of the batch go to the currentZone.Computed.run()rethrows its selector error also when a cleanup at the end of the run evaluates theComputedagain. Disposing anEffect,Computedor signal now runs outside dependency tracking, so anonDisposecallback that reads a signal no longer subscribes the running effect. This includes the disposal of an effect whose first run fails inside another effect. A disposedResourceno longer subscribes to itssourceor stream, and no longer writes the result of a pending fetch or refetch.refresh()after disposal does nothing, and disposal cancels a pending debounced refresh. Two debounced resources on the same source now each refresh (#205, #206). Disposing the last signal of an effect orComputedthat a batch left pending no longer throws a null check error at the end of the batch. A failedComputedevaluation now records its inputs before the disposal drain at its end, and aComputed.run()does not notify again a change that a run in that drain already delivered. Also, aComputedleft by its observers no longer keeps a reference to a disposed input (#207). - BREAKING:
SignalBasehas two new getters,untrackedHasValueanduntrackedHasPreviousValue: the untracked versions ofhasValueandhasPreviousValue. They never subscribe the running effect and never run aComputed's selector (Computed.untrackedHasValueis always true). DevTools uses them.Resource.hasValuenow resolves a lazy resource, likestate, soobserve()andaddListener()readhasValuebeforevalueon every signal type. A class that implementsSignalBasedirectly (for example a test double) must implement both. A subclass or test double that overridesvalueshould also overridehasValueanduntrackedHasValue. One that overridespreviousValueshould also overridehasPreviousValueanduntrackedHasPreviousValue. - FIX: Turning on DevTools no longer changes how signals behave: DevTools now reads values without tracking them, running a lazy selector or fetcher, or triggering auto-dispose. With DevTools on, a dependency-free
autoDisposeComputedis no longer disposed when it is created, a lazyComputedorResourceno longer computes or fetches when it is created, anautoDisposeComputedis disposed when its last dependency is disposed, and an effect no longer depends on a signal it creates. - CHORE: DevTools extension 0.3.0: it uses
shadcn_ui0.61 (built onmaterial_ui) and follows the DevTools light or dark theme when it changes. - FIX: When an effect throws while queued effects run (for example at the end of a
batch()), the other queued effects still run, and the first error is rethrown after all of them. Before, the effects queued after the throwing one were skipped until their dependencies changed again. This also applies to an effect that reads a throwingComputedand to anonErrorhandler that throws. An effect'sonErrornow also handles errors from its reactive reruns, not only from its first run. An effect that writes a signal no longer runs other effects in the middle of its own run: the effects that the write triggers run after the writing effect ends. So an error from one of them can no longer stop the writing effect, or reach itsonError. - FIX:
untrackedPreviousValuenow returns the same value aspreviousValue(also onComputed), andobserve()passes that value to its listener (#190). Before, it ignoredtrackPreviousValue: false, and it was not updated by in-place changes to aListSignal,MapSignalorSetSignal(add,[]=,removeand similar). A collection mutation that changes nothing no longer overwrites the previous value. Replacing a wholeMapSignalorSetSignalkeeps the old collection, with its equality, as the previous value. WithtrackPreviousValue: false,Resource.untrackedPreviousStateandSignal.toString()now also report no previous value. - PERF: Collection signals check only the affected slot for point writes and only the affected slots for list range writes.
MapSignal.update,putIfAbsentandaddAllcheck only the keys they touch. Mutations that only add or only remove elements or entries check the length and any nested signal writes. So doreplaceRangewith aListorSetof another length, andMapSignal.addAllinto an empty map.fillRangereads the range only up to the first slot that it changes, and withtrackPreviousValue: falseit uses no extra memory for the range. AfillRangethat changes nothing makes no copy. A mutation with an emptyListorSet(for exampleaddAll(const [])), orlength =with the current length, makes no copy.addEntriesskips the copy only for an emptyListorSet: any other input, even an empty one such asmap.entries, compares the whole map.updateAll,sort,shuffle,setAllwith an iterable that is not aList, and a non-emptyaddEntriesstill compare the whole collection, because their input can run code each time it is read. So withtrackPreviousValue: falsethey keep a temporary snapshot of the collection (for a map, two references per entry), while the bounded checks above copy nothing. With history on, the signal still makes one full copy for the previous value. With DevTools on, each change still serializes the whole collection. With history on, aMapSignalmutation copies the map before it changes it, so if a key'shashCodethrows, the mutation throws and the map does not change. - FIX:
ListSignal,MapSignalandSetSignalmutations now follow one rule (#196). A mutation that changes the collection notifies once, with the collection as it was before as the previous value. A mutation that changes nothing, or that throws before it changes anything, does not notify and keeps the previous value. A mutation that throws after a partial change (for exampleaddAllfrom an iterable that throws) still notifies once. Mutations that only add or only remove elements or entries detect length changes and changes made through the signal inside a callback. With history on, a list mutation that can change the length (for exampleadd,insert,removeAt,remove,removeWhere,retainWhere,removeRange,replaceRange,addAllorinsertAll) and then throws also compares the elements, so elements moved before the error are found. A callback of a collection mutation that writes directly to the backing collection (for examples.untrackedValue['b'] = 3insideupdate) is seen only if it changes the length or a slot that the mutation checks. Writes through the signal are always seen. If a callback assigns a new collection during a mutation, the previous value is the collection as it was before the mutation started. If an effect or observer throws during that notification, the mutation's own error is still thrown, and the other error goes to the currentZone. Elements and values are compared withidentical, so writing an equal but distinct object is a change. Each mutation runs on the underlying collection, so it returns and throws like the same call on a plain collection: for example,sortandshufflechange the list in place, andremoveuses the set's own equality and returnsfalsefor an object of another type.MapSignal.updateAllbehaves like the backing map'supdateAll: if the callback throws partway, the entries already updated stay updated, and observers are notified once.MapSignal.update,retainWhereandMapSignal.updateAllnow notify correctly, and a mutation inside an effect no longer makes the effect depend on the collection. For aMapSignalmutation, the previous value is a plainMap, without a custom key equality. Known limitation (#208): collection signals detect changes by comparing elements withidentical. So a typed SIMD list (for exampleFloat32x4List, where each element read creates a new object) can report a change for a rejected or no-op mutation. A mutation of acast()view that holds entries of the wrong type can throw aTypeError.addAll({})on acast()map is a no-op. - CHORE: Depend on
package:listenfor theListenable/ValueNotifier/ValueListenableprimitives.solidartstays pure Dart: it does not import Flutter. Since Flutter 3.50,package:flutter/foundation.dartre-exports these samelistentypes (flutter/flutter#189111), so in a Flutter app a signal is a FlutterListenableand works directly with Flutter APIs. Flutter apps getlistenfrom bothsolidartand the Flutter SDK, so the two constraints must agree (both use^1.0.1).
3.0.0-dev.2 #
- FEAT:
Resourcenow exposespreviousReadyandpreviousError— the most recent ready / error state, retained across any number of intervening transitions (unlikepreviousState, which remembers only the single prior state). Handy to keep a UI populated across repeated refresh failures, e.g.resource().asReady?.value ?? resource.previousReady?.value. Gated bytrackPreviousValue.
3.0.0-dev.1 #
- BREAKING:
SolidartConfig.autoDisposenow defaults tofalse— auto-dispose is opt-in from v3. Enable it globally (SolidartConfig.autoDispose = true) or perSignal/Computed/Effectvia theautoDisposeparameter. - FIX:
Effectnow honours its per-instanceautoDisposeflag (defaulted fromSolidartConfig.autoDisposeat creation), consistent withSignalandComputed. Previously an effect only auto-disposed when the globalSolidartConfig.autoDisposewas enabled, ignoring a per-instanceautoDispose: true. - CHORE: Upgrade
alien_signalsto^2.3.1and adapt the internal reactive adapter to its preset/system APIs. - FIX: A lazy nullable
Signal(e.g.Signal<int?>.lazy()) now notifies when it is first set tonull; previously theNone→Some(null)transition was treated as "no change". - FIX: Disposing a signal now fully unlinks its subscribers on both sides of each dependency link — and does so regardless of
SolidartConfig.autoDispose(a disposed signal is destroyed, likeEffect/Computeddisposal) — so a later write to the disposed signal can no longer propagate into an already-detached computed. - FIX:
Computed.listenerCountnow reports the number of subscribers instead of the number of dependencies. This also correctsResource's source cleanup, which useslistenerCountto decide whether to dispose aComputedpassed as itssource. - FIX: Disposing a
Computednow unlinks all of its subscribers instead of only the first (leaving no dangling links back to it) and offers each subscriber the chance to auto-dispose, matching signal disposal. - REFACTOR:
ReactiveSystem,reactiveSystem, and theMayDisposeDependenciesextension are no longer exported from the publicsolidart.dartbarrel — they expose internalalien_signalstypes and are implementation detail. Sibling packages consume them viapackage:solidart/solidart_internal.dart.
2.8.6 #
- FIX: Prevent effect re-entrancy when a signal is written during the effect's first run. The write no longer re-enters the running effect mid-execution, which could throw
LateInitializationError.
2.8.5 #
- FIX: Return up-to-date value from
Computed.untrackedValueafter dependency changes.
2.8.4 #
- FIX: Prevent
LateInitializationErrorwhen accessingComputed.untrackedValuebefore firstvalueaccess.hasValuenow triggers lazy computation, anduntrackedValueasserts with a clear message if accessed before computation.
2.8.3 #
- FIX: Handle race conditions in Resource that caused multiple calls to
resolve.
2.8.2 #
- REFACTOR: Improve the Solidart DevTools extension by giving any signal an id and omit overriding the same signal by name.
2.8.1 #
- FIX: Expose
untilmethod forComputed.
2.8.0 #
- REFACTOR: Deprecate
maybeOnandonmethods ofResourceState. UsemaybeWhenandwheninstead.
2.7.1 #
- REFACTOR: Rename
updatetoshouldUpdateinReadableSignal.
2.7.0 #
- FEAT: Add
thenextension method toFutureOr. This allows you to use thethenmethod on bothFutureandFutureOrvalues seamlessly. Mainly needed to simplify the usage ofReadableSignal.untilandResource.untilReadymethods.final count = Signal(10); count.until((value) => value > 5).then((value) { print('The count is now greater than 5: $value'); });
2.6.1 #
- FIX: Fix auto disposal of
Computedwhich happened even ifautoDisposewas set to false.
2.6.0 #
- REFACTOR: Make auto disposal synchronous.
2.5.0 #
- FEAT: Add
runmethod toComputedto manually trigger an update of its value. - FEAT: Add
runmethod toEffectto manually re-run the effect. - CHORE: Detect if
Effectdidn't track any reactive value and throw anEffectWithoutDependenciesError.
2.4.1 #
- FIX:
Signal.lazywhich caused an exception.
2.4.0 #
- FEAT: Add
Debouncerutility class to easily debounce operations anddebounceDelaytoResourceto debounce source changes if they fire very often.
2.3.0 #
- FEAT: Allow extending signal, computed, resource, list-signal, set-signal and map-signal.
2.2.0 #
- FEAT: Add
timeoutparameter toSignal.untilmethod to specify a timeout duration. If the condition is not met within the specified duration, the returned future will complete with aTimeoutException.
2.1.1+1 #
- CHORE: Update
README.mdwith new contributors.
2.1.1 #
- CHORE: Bump the
alien_signalsdependency to^0.5.1for slight performance improvements (thanks to @medz).
2.1.0 #
- REFACTOR: Update
alien_signalsdependency from^0.2.1to^0.4.3with significant performance improvements (thanks to @medz). - REFACTOR: Replace custom reactive node implementations with
alien.ReactiveNodefor better compatibility and performance (thanks to @medz). - REFACTOR: Simplify signal, computed and effect implementations by leveraging new
alien_signalsAPI (thanks to @medz). - PERFORMANCE: Improve performance by removing redundant tracking operations in the reactive system (thanks to @medz).
- FIX: Add proper cleanup for disposed nodes to prevent memory leaks (thanks to @medz).
- FIX: Fix potential memory leaks in auto-dispose scenarios (thanks to @medz).
- FIX: Clear queued flag when running effects in
ReactiveSystemto ensure proper effect execution (thanks to @medz). - CHORE: Reorder dev_dependencies in pubspec.yaml for improved organization and readability (thanks to @medz).
2.0.1 #
- FIX: DevTools extension not working.
2.0.0 #
- CHORE: Improve the performance by using
alien_signalsfor the reactive system. - FEAT: Expose
untracked. - REFACTOR: Updated the reactive system from scratch, improving the performances.
- BREAKING CHANGE: Remove
setandcallmethods from Signals (Use an extension to have them back). - FEAT: Add
useRefreshingtoResourceto decide whether to update the current state withisRefreshing(defaults to true). If you set it to false, when refreshing, the resource will go directly to the loading state. - FEAT: Add
Signal.lazyto allow the creation of a signal without an initial value. Be aware, the signal will throw an error if you try to read its value before it has been initialized. - CHORE: Remove deprecated
createSignal,createComputed,createEffectandcreateResourcehelpers. - CHORE: Remove
SignalOptionsandResourceOptionsclasses. - FEAT: Add
batchfunction to execute a callback that will not side-effect until its top-most batch is completed. See docs here - CHORE: Add
trackInDevToolstoSignalOptionsandResourceOptionsto disable the DevTools tracking for specific signals and resources, defaults toSolidartConfig.devToolsEnabled.
2.0.0-dev.6 #
- FEAT: Expose
untracked.
2.0.0-dev.5 #
- CHORE: Improve the performance
2.0.0-dev.4 #
- REFACTOR: Updated the reactive system from scratch, improving the performances.
- BREAKING CHANGE: Remove
setandcallmethods from Signals (Use an extension to have them back). - FEAT: Add
useRefreshingtoResourceto decide whether to update the current state withisRefreshing(defaults to true). If you set it to false, when refreshing, the resource will go directly to the loading state.
2.0.0-dev.3 #
- FEAT: Add
Signal.lazyto allow the creation of a signal without an initial value. Be aware, the signal will throw an error if you try to read its value before it has been initialized.
2.0.0-dev.2 #
- CHORE: Remove deprecated
createSignal,createComputed,createEffectandcreateResourcehelpers. - CHORE: Remove
SignalOptionsandResourceOptionsclasses.
2.0.0-dev.1 #
- FEAT: Add
batchfunction to execute a callback that will not side-effect until its top-most batch is completed. See docs here - CHORE: Add
trackInDevToolstoSignalOptionsandResourceOptionsto disable the DevTools tracking for specific signals and resources, defaults toSolidartConfig.devToolsEnabled.
1.5.4 #
- CHORE: Add
devToolsEnabledoption to manually disable the DevTools extension that defaults tokDebugMode
1.5.3 #
- BUGFIX: Fix an auto dispose issue of Signals that have some active observations.
1.5.2 #
- BUGFIX: Fix DevTools extension with null signal name.
1.5.1 #
- CHORE: Upload DevTools extension to pub.dev
1.5.0 #
- FEAT: Add DevTools extension to solidart.
1.4.1 #
- BUGFIX: The method
didUpdateSignalofSolidartObserverwas not triggered for collections.
1.4.0 #
- FEAT: Create
SolidartConfigwhich you can use to customize theautoDisposeof all the tracking system and andobservers. - BUGFIX: Removed the internal
ResourceUnresolvedstate so you can easily use theResourceStatesealed class.
1.3.0 #
- FEAT: Automatic disposal, see the docs here
1.2.2 #
- BUGFIX: Fix the
updatemethod of aResourcethat triggeredreportObserved.
1.2.1 #
- BUGFIX: Fix the
updateValuemethod of aSignalthat triggeredreportObserved. (thanks to @9dan)
1.2.0 #
-
FEAT: Add 3 new signals:
ListSignal,SetSignalandMapSignal. Now you can easily be notified of every change of a list, set or map. Before:final list = Signal([1, 2]); // this doesn't work list.add(3); // instead you have to provide a new list instance list.value = [...list, 3];Now:
final list = ListSignal([1, 2]); // this now works as expected list.add(3); -
CHORE: Rename the
firstWheremethod of aReadSignalintountil -
CHORE: Rename the
firstWhereReadymethod of aResourceintountilReady -
CHORE: Rename the
updatemethod of aSignalintoupdateValue -
CHORE: Deprecate
createSignal,createComputed,createEffectandcreateResource
1.1.0 #
- BUGFIX: Fix a bug in the
Resourcewhere the stream subscription was not disposed correctly
1.0.1 #
Improve copyWith methods of ResourceReady and ResourceError
1.0.0+4 #
Fix the pub.dev pub points.
1.0.0+3 #
Fix the pub.dev pub points.
1.0.0+2 #
Fix the pub.dev pub points.
1.0.0+1 #
Fix the pub.dev pub points.
1.0.0 #
The core of the library has been rewritten in order to support automatic dependency tracking like SolidJS.
-
FEAT: Add automatic dependency tracking
-
BREAKING CHANGE: To create derived signals now you should use
createComputedinstead ofsignalName.selectThis allows you to derive from many signals instead of only 1.Before:
final count = createSignal(0); final doubleCount = count.select((value) => value * 2);Now:
final count = createSignal(0); final doubleCount = createComputed(() => count() * 2); -
FEAT: The
createEffectno longer needs asignalsarray, it automatically track each signal.Before:
final effect = createEffect(() { print('The counter is now ${counter.value}'); }, signals: [counter]);Now:
final disposeFn = createEffect((disposeFn) { print('The counter is now ${counter.value}'); }) -
BREAKING CHANGE: The
fireImmediatelyfield on effects has been removed. Now an effect runs immediately by default. -
FEAT: Add
observemethod onSignal. Use it to easily observe the previous and current value instead of creating an effect.final count = createSignal(0); final disposeFn = count.observe((previousValue, value) { print('The counter changed from $previousValue to $value'); }, fireImmediately: true); -
FEAT: Add
firstWheremethod onSignal. It returns a future that completes when the condition evaluates to true and it returns the current signal value.final count = createSignal(0); // wait until the count is greater than 5 final value = await count.firstWhere((value) => value > 5); -
FEAT: Add
firstWhereReadymethod onResource. Now you can wait until the resource is ready.final resource = createResource(..); final data = await resource.firstWhereReady(); -
FEAT: The
Resourcenow acceptsResourceOptions. You can customize thelazyvalue of the resource (defaults to true), if you want your resource to resolve immediately. -
CHORE:
ResourceValuehas been renamed intoResourceState. Now you can get the state of the resource with thestategetter. -
CHORE: Move
refreshingfromResourceWidgetBuilderinto theResourceState. (thanks to @manuel-plavsic) -
FEAT: Add
hasPreviousValuegetter toReadSignal. (thanks to @manuel-plavsic) -
FEAT Before, only the
fetcherreacted to thesource. Now also thestreamreacts to thesourcechanges by subscribing again to the stream. In addition, thestreamparameter of the Resource has been changed fromStreaminto aStream Function()in order to be able to listen to a new stream if it changed. -
FEAT: Add the
selectmethod on theResourceclass. Theselectfunction allows filtering theResource's data by reading only the properties that you care about. The advantage is that you keep handling the loading and error states. -
FEAT: Make the
Resourceto auto-resolve when accessing itsstate. -
CHORE: The
refetchmethod of aResourcehas been renamed torefresh. -
FEAT: You can decide whether to use
createSignal()or directly theSignal()constructor, now the're equivalent. The same applies to all the othercreatefunctions.
1.0.0-dev8 #
- FEAT: Add the select method on the Resource class. The select function allows filtering the Resource's data by reading only the properties that you care about. The advantage is that you keep handling the loading and error states.
- FEAT: Make the Resource to auto-resolve when accessing its state
1.0.0-dev7 #
- CHORE:
createComputednow returns aComputedclass instead of aReadSignal.
1.0.0-dev6 #
- FEAT Before, only the
fetcherreacted to thesource. Now also thestreamreacts to thesourcechanges by subscribing again to the stream. In addition, thestreamparameter of the Resource has been changed fromStreaminto aStream Function()in order to be able to listen to a new stream if it changed
1.0.0-dev5 #
- BUGFIX Refactor the core of the library in order to fix issues with
previousValueandhasPreviousValueofComputedand simplify the logic.
1.0.0-dev4 #
- Move
refreshingfromResourceWidgetBuilderinto theResourceState. (thanks to @manuel-plavsic) - Add
hasPreviousValuegetter toReadSignal. (thanks to @manuel-plavsic)
1.0.0-dev3 #
- Deprecate
valuegetter in theResource. Usestateinstead. - Remove
wheremethod fromReadSignal.
1.0.0-dev2 #
-
Rename
untilintofirstWhere -
Rename
untilReadyintofirstWhereReady -
FEAT: add
wheremethod toSignal. It returns a newReadSignalwith the values filtered bycondition. Use it to filter the value of another signal, e.g.:final loggedInUser = user.where((value) => value != null);The initial value may be null because a
Signalmust always start with an initial value. The following values will always satisfy the condition. The returnedReadSignalwill automatically dispose when the parent signal disposes.
1.0.0-dev1 #
This is a development preview of the 1.0.0 release of solidart. The core of the library has been rewritten in order to support automatic dependency tracking like SolidJS.
-
FEAT: Add automatic dependency tracking
-
BREAKING CHANGE: To create derived signals now you should use
createComputedinstead ofsignalName.selectThis allows you to derive from many signals instead of only 1.Before:
final count = createSignal(0); final doubleCount = count.select((value) => value * 2);Now:
final count = createSignal(0); final doubleCount = createComputed(() => count() * 2); -
FEAT: The
createEffectno longer needs asignalsarray, it automatically track each signal.Before:
final effect = createEffect(() { print('The counter is now ${counter.value}'); }, signals: [counter]);Now:
final disposeFn = createEffect((disposeFn) { print('The counter is now ${counter.value}'); }) -
BREAKING CHANGE: The
createEffectmethod no longer returns anEffect, you cannot pause or resume it anymore. Instead it returns aDisposecallback which you can call when you want to stop it. You can also dispose an effect from the inside of the callback. -
BREAKING CHANGE: The
fireImmediatelyfield on effects has been removed. Now an effect runs immediately by default. -
FEAT: Add
observemethod onSignal. Use it to easily observe the previous and current value instead of creating an effect.final count = createSignal(0); final disposeFn = count.observe((previousValue, value) { print('The counter changed from $previousValue to $value'); }, fireImmediately: true); -
FEAT: Add
untilmethod onSignal. It returns a future that completes when the condition evaluates to true and it returns the current signal value.final count = createSignal(0); // wait until the count is greater than 5 final value = await count.until((value) => value > 5); -
FEAT: Add
untilReadymethod onResource. Now you can wait until the resource is ready.final resource = createResource(..); final data = await resource.untilReady(); -
FEAT: The
Resourcenow acceptsResourceOptions. You can customize thelazyvalue of the resource (defaults to true), if you want your resource to resolve immediately. -
CHORE:
ResourceValuehas been renamed intoResourceState. Now you can get the state of the resource with thestategetter.
0.3.0 #
- BUGFIX: Listening to the
sourceof a Resource was not stopped when thesourcedisposed. - BUGFIX: A
Resourcewould not perform the asynchronous operation until someone called thefetchmethod, typically theResourceBuilderwidget. This did not apply to thestreamwhich was listened to when the resource was created. Now the behaviour has been merged and thefetchmethod has been renamed intoresolve. - CHORE: Renamed
ReadableSignalintoReadSignal. - CHORE: Renamed the
readablemethod of aSignalintotoReadSignal()
0.2.4 #
- Add assert to resource
fetchmethod to prevent multiple fetches of the same resource.
0.2.3 #
- The
selectmethod of a signal now can take a customoptionsparameter to customize its behaviour. - Fixed an invalid assert in the
ResourceBuilderwidget that happens for resources without a fetcher.
0.2.2 #
createResourcenow accepts astreamand can be used to wrap a Stream and correctly handle its state.
0.2.1 #
- Get a signal value with
signalName().
0.2.0+1 #
- Add documentation link inside the pubspec
0.2.0 #
- Documentation improvements
- Refactor Resource, now the
createResourcemethod takes only 1 generic, the type of the future result.// before final resource = createResource<SourceValueType, FetcherValueType>(fetcher: fetcher, source: source); // now final resource = createResource<FetcherValueType>(fetcher: fetcher, source: source); // the FetcherValueType can be inferred by Dart >=2.18.0, so you can omit it
0.1.2 #
- Add official documentation link
- Fix typo in fireImmediately argument name
0.1.1 #
- Set the minimum Dart SDK version to
2.18.
0.1.0+6 #
- Update Readme
0.1.0+5 #
- Add code coverage
0.1.0+4 #
- Fix typo in README
0.1.0+3 #
- Decrease minimum Dart version to 2.17.0
0.1.0+2 #
- Remove unused import
0.1.0+1 #
- Fix typos on links
0.1.0 #
- Initial version.