reactter 3.0.0-dev.5 reactter: ^3.0.0-dev.5 copied to clipboard
Reactter is a light, powerful and reactive state management.
Reactter by 2devs.io #
3.0.0-dev.5 #
Breacking #
- build: Change structure folder. Now the package was separated into two packages, one for dart only(
reactter
) and one for flutter(flutter_reactter
). - refactor(hooks): Type return on
UseAsyncState.when
. - refactor(widgets): Replace
UseContext
toReactterProvider
. - refactor(widgets): Replace
ReactterProvider
toReactterProviders
. - refactor: Rename
LifeCycleEvent.onWillMount
toLifecycle.willMount
,LifeCycleEvent.onDidMount
toLifecycle.didMount
,LifeCycleEvent.onWillUpdate
toLifecycle.willUpdate
,LifeCycleEvent.onDidUpdate
toLifecycle.didUpdate
andLifeCycleEvent.onWillUnmount
toLifecycle.willUnmount
. - refactor(core): Move
Reactter.factory.register
toReactter.register
,Reactter.factory.unregistered
toReactter.unregister
,Reactter.factory.existsInstance
toReactter.factory.exists
,Reactter.factory.getInstance
toReactter.get
,Reactter.factory.deletedInstance
toReactter.delete
. - refactor(core): Replace
ReactterSubscribersManager
toUseEvent
. - refactor(core): Replace
BuildContext.read
andBuildContext.readId
toBuildContext.use
.
Changed #
- feat(widgets): Improve finding
ReactterContext
in the widget tree via theBuildContext
. Now the operation of findingReactterContext
is O(1) andReactterContext
using id is O(2).
Added #
- refactor(hooks): Add more
Lifecycle
events(Lifecycle.registered
,Lifecycle.unregistered
,Lifecycle.registered
andLifecycle.destroyed
) - feat(hooks): Add
UseContext
hook. - feat(hooks): Add
UseEvent
hook. - feat(widgets): Add
ReactterScope
widget. - refactor(core): Add
Reactter.create
andReactter.find
.
2.3.3 #
2.3.1 #
Changed #
- fix(example): Fix typo on counter example button.
- fix(example): Add implement tags on animation example.
2.3.0 #
Changed #
- refactor: Rename
context.of
tocontext.watch
. - refactor: Rename
context.ofId
tocontext.watchId
. - refactor: Rename
context.ofStatic
tocontext.read
. - refactor: Rename
context.ofIdStatic
tocontext.readId
. - refactor: Move subscribe and publish pattern to
ReactterSubscribersManager
class. Can use subscribe and publish pattern with enum type specified. - refactor(core,hooks): Remove innecesary code.
- fix(hooks,widgets): Delete instances of
UseContext
when dispatch updated event onReactterProvider
, for prevent has instances duplicated. - refactor(widgets): Use
ReactterInheritedProvider
as scope onReactterBuilder
. - refactor(engine): Remove props innecesary on
ReactterInheritedProvider
. - refactor(core): Improve performance how instances manager on
ReactterFactory
. - refactor(widgets): Add
ReactterBuilder
as scope when doesn't has builder onReactterComponent
. - refactor(hooks): Clear code and do code simple on
UseAsyncState
. - refactor(core): Remove context property as public on
ReactterHook
. - docs: Fix some documentation.
- feat(engine): Remove dependencies when
ReactterProvider
unmount. - refactor(core): Remove unneccesaries event listeners from
ReactterContext
. - refactor(core):
HookManager
subscribe towillUpdate
anddidUpdate
event. - refactor(core):
WillUpdate
andDidUpdate
event trigger when itsReactterHook
update. - refactor(engine): Manage dependencies of
ReactterPubSub
andlifecycle
ofReactterContext
. - refactor(widget): Performance as the instance of
context
is listen to mark need build. - refacor(widget): Fix
ReactterBuilder
. - refactor(core): Improve
UseEffect
. Now the return of callback execute when a hook was change orwillUnmount
event was invoke. - refactor(core): Improve
lifecycle
events. Now it use as subscription. - refactor(hooks, widgets) - Rename
UseProvide
toReactterProvider
.
Added #
- feat(example): Add more example with animation
- feat(example): Add new examples.
- docs: Add badgets, reorder topic, fix examples and improve redacty redaction on README.
- feat(widgets): Send
id
for findReactterContext
onReactterComponent
. - docs: Add more documentation.
- tests: Add tests for
hooks
andWidgets
. - feat(widget): Add type on
listenerHooks
ofReactterBuilder
. - feat(hooks): Add argument to
resolve
method ofUseAsyncState
. - feat(hooks): Add
lifecycle
willUpdate
anddidUpdate
. - feat(widget): Add
onInit
toUseContext
. - feat(hooks):
UseEffect
has lifecycle control of the context. - feat(hook)
UseContext
works with unique ids to create unique instances. - feat(widget): Add
ReactterComponent
.
2.3.0-dev.3 #
2.2.0-dev.1 #
Changed #
- refactor: Move subscribe and publish pattern to
ReactterSubscribersManager
class. Can use subscribe and publish pattern with enum type specified. - refactor(core,hooks): Remove innecesary code.
- fix(hooks,widgets): Delete instances of
UseContext
when dispatch updated event onReactterProvider
, for prevent has instances duplicated. - refactor(widgets): Use
ReactterInheritedProvider
as scope onReactterBuilder
. - refactor(engine): Remove props innecesary on
ReactterInheritedProvider
. - refactor(core): Improve performance how instances manager on
ReactterFactory
. - refactor(widgets): Add
ReactterBuilder
as scope when doesn't has builder onReactterComponent
. - refactor(hooks): Clear code and do code simple on
UseAsyncState
. - refactor(core): Remove context property as public on
ReactterHook
.
Added #
- feat(example): add new examples.
- docs: Add badgets, reorder topic, fix examples and improve redacty redaction on README.
2.1.0-dev #
Changed #
- feat(engine): Remove dependencies when
ReactterProvider
unmount. - refactor(core): Remove unneccesaries event listeners from
ReactterContext
. - refactor(core):
HookManager
subscribe towillUpdate
anddidUpdate
event. - refactor(core):
WillUpdate
andDidUpdate
event trigger when itsReactterHook
update. - refactor(engine): Manage dependencies of
ReactterPubSub
andlifecycle
ofReactterContext
. - refactor(widget): Performance as the instance of
context
is listen to mark need build. - refacor(widget): Fix
ReactterBuilder
. - refactor(core): Improve
UseEffect
now the return of callback execute when a hook was change orwillUnmount
event was invoke. - refactor(core): Improve
lifecycle
events now it use as subscription. - refactor(hooks, widgets) - Rename
UseProvide
toReactterProvider
.
Added #
- feat(widgets): Send
id
for findReactterContext
onReactterComponent
. - docs: Add more documentation.
- tests: Add tests for
hooks
andWidgets
. - feat(widget): Add type on
listenerHooks
ofReactterBuilder
. - feat(hooks): Add argument to
resolve
method ofUseAsyncState
. - feat(hooks): Add
lifecycle
willUpdate
anddidUpdate
. - feat(widget): Add
onInit
toUseContext
.
2.0.0-dev.1 #
1.0.1 #
1.0.0 #
1.0.0-dev #
Changed #
-
No need package dependencies: We decided to remove all dependencies and create a new state management from scratch.
-
Controller now is Context:
ReactterController
has been replaced byReactterContext
, which are the classes that going to manage our states.class AppContext extends ReactterContext {}
Added #
-
Two ways to manage state: You can control the listeners from context like this:
class AppContext extends ReactterContext { /* You can create the state here and add it to dependencies in constructor with listenHooks() */ final username = UseState<String>(""); AppContext(){ listenHooks([username]); } /* But we recommend to give the context to the state this way: With this, you no longer need to put it in listenHooks() which is cleaner */ late final firstName = UseState<String>("Leo", context: this); late final lastName = UseState<String>("León", context: this); }
-
Added UseProvider widget:
UseProvider
provide allReactterContext
to his children.UseProvider( contexts: [ UseContext( () => AppContext(), init: true, ), ], builder: (context, _) { // Get all the states listeners of context. final appContext = context.of<AppContext>(); // Get the listener of an specific state to rebuild. final appContext = context.of<AppContext>((ctx) => [ctx.userName]); // Read all the states, but no rebuild when change. final appContextStatic = context.ofStatic<AppContext>(); return Text(appContext.username.value); } );
-
Remove UseEffect widget: This widget has been replaced by a class called
UseEffect
. It has exactly the same functionality as theReact Hook
, when a dependency changes, executes the callback parameter.UseEffect((){ userName.value = firstName + lastName; }, [firstName, lastName]);
-Note*: UseEffect has to be called inside context constructor.
-
Added custom Hooks: You can create your own hooks with mixin inherit from
ReactterHook
.mixin UseCart on ReactterHook { late final cart = UseState<Cart?>(null, context: this); addProductToCart(Product product) { final oldProducts = cart.value.products; cart.value = cart.value? .copyWith(products: [...oldProducts, product]); } }
-
Added UseAsyncState class: If you need an async state, you can use this:
class AppContext extends ReactterContext { ... late final userName = UseAsyncState<String>("Init state", fillUsername, context: this); Future<String> fillUsername() async { final userFromApi = await getUserName(); return userFromApi; } ... }
-
Added UseAsyncState.when function: Added this function to controll the async flow from
UseAsyncState
:... ), userContext.userName.when( // Base state standby: (value) => Text("Standby: " + value), // When is executing the async code loading: () => const CircularProgressIndicator(), // When the async code has finished done: (value) => Text(value), // When it throw an error error: (error) => const Text( "Unhandled exception", style: TextStyle(color: Colors.red), ), ), ...
-
Added lifecycle methods to ReactterContext:
@override awake() { // Executes when the instance starts building. } @override willMount() { // Before the dependency widget will mount in the tree. } @override didMount() { // After the dependency widget did mount in the tree. } @override willUnmount() { // When the widget removes from the tree. }