solidart 1.0.0+1
solidart: ^1.0.0+1 copied to clipboard
A simple State Management solution for Dart applications inspired by SolidJS
1.0.0+1 #
Fix the pub.flutter-io.cn 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 evalutes 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 evalutes 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.