-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: clarify API elements that are not stabilized (#46)
- Loading branch information
1 parent
8aeca02
commit 632c680
Showing
7 changed files
with
48 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ environment: | |
dependencies: | ||
flutter: | ||
sdk: flutter | ||
meta: ^1.10.0 | ||
rearch: ^1.3.3 | ||
|
||
dev_dependencies: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/// A collection of ReArch experiments in case you like exploring the unknown. | ||
/// | ||
/// Nothing here is officially supported; | ||
/// items may come and go or experience breaking changes on any new release. | ||
/// Further, items here may be untested so use at your own risk! | ||
@experimental | ||
library experimental; | ||
|
||
import 'package:meta/meta.dart'; | ||
import 'package:rearch/rearch.dart'; | ||
|
||
extension _UseConvenience on SideEffectRegistrar { | ||
SideEffectRegistrar get use => this; | ||
} | ||
|
||
/// A collection of experimental side effects to | ||
/// complement the [BuiltinSideEffects]. | ||
extension ExperimentalSideEffects on SideEffectRegistrar { | ||
/// Returns a raw value wrapper; i.e., a getter and setter for some value. | ||
/// *The setter will not trigger rebuilds*. | ||
/// The initial state will be set to the result of running [init], | ||
/// if it was provided. Otherwise, you must manually set it | ||
/// via the setter before ever calling the getter. | ||
// NOTE: experimental because I am not sold on the API and use cases | ||
// for non-internal usage. | ||
(T Function(), void Function(T)) rawValueWrapper<T>([T Function()? init]) { | ||
return use.callonce(() { | ||
late T state; | ||
if (init != null) state = init(); | ||
return (() => state, (T newState) => state = newState); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters