reactter 7.2.0-dev.3 reactter: ^7.2.0-dev.3 copied to clipboard
A light, powerful and quick Reactive State Management, Dependency Injection and Event Handler.
Reactter #
7.2.0-dev.3 #
Breakings #
- refactor(core,hooks,test): Deprecate and replace some enums and methods on Lifecycle to use the right concept.
- Deprecated
Lifecycle.initialized
, useLifecycle.created
instead. - Deprecated
Lifecycle.destroyed
, useLifecycle.deleted
instead. - Deprecated
onInitialized
method ofLifecycleObserver
, useonCreated
method instead. - Deprecated
onDestroyed
method ofLifecycleObserver
, useonDeleted
method instead.
- Deprecated
- refactor(widgets): Update
ReactterProvider
to useReactterProvider.init
constructor instead ofinit
property.- Deprecated
init
property ofReactterProvider
, useReactterProvider.init
instead.
- Deprecated
Enhancements #
- feat(core): Add
Reactter.hasRegister
method to check if the dependency is registered in Reactter. - refactor(framework): Improve lazy loading performance in
ProviderImpl
, update implementation to reduce unnecessary checks and streamline widget rendering.
Fixes #
- fix(core): Prevent all
ReactterDependency
events from being deleted after deregistering a dependency.- Update
offAll
method inEventHandler
to support generic removal.
- Update
- fix(hooks): Ensure that the callback is executed by the
dependencies
ofUseEffect
. - refactor(hooks): Improve error handling in
UseEffect
.
Internal #
- refactor(core,framework,hooks): Update
dependencyInjection
getter names in Reactter codebase. - refactor(framework,test): Rename
reactter_instance
toreactter_dependency
and fix imports and exports. - doc(hooks): Update
UseReducer
andUseState
documentation to improve clarity and consistency. - test(core,hooks): Rename some files and update the descriptions.
- test(core): Add
Reactter.hasRegister
test. - refactor: Remove unnecessary 'late' modifier in
TestController
. - test: Add comparable test cases for
Args
. - refactor: π Improve some comments and documentation for clarity and consistency.
- test: π Update the descriptions of some test for clarity and consistency.
- test(widgets): Add test case for nullish dependency obtained from context.
- test(widgets): Add test case for getting dependency form
ReactterProvider
siblings.
7.1.0 #
Breakings #
- refactor(core,framework,hooks,test): Deprecate and replace some classes and methods to use the right concept.
- Deprecated
UseInstance
hook, useUseDependency
hook instead. - Deprecated
InstanceManageMode
enum, useDependencyMode
enum instead. - Deprecated
ReactterInstance
class, useReactterDependency
class instead. - Deprecated
getInstanceManageMode
method, usegetDependencyMode
method instead.
- Deprecated
Internal #
- refactor(core,framework,hooks,test): Deprecate and replace some classes and methods to use the right concept.
- Renamed
InstanceManager
class toDependencyInjection
. - Renamed
EventManager
class toEventHandler
. - Renamed
StateManager
class toStateManagement
.
- Renamed
7.0.1 #
Internal #
- test: Refactor and structure examples.
- doc: Update
ReactterWatcher
builder comments for clarity.
7.0.0 #
Enhancements #
- feat(core, framework): Add
Reactter.batch
andReactter.untracked
methods.Reactter.batch
hepls to execute the givencallback
function within a batch operation. A batch operation allows multiple state changes to be grouped together, ensuring that any associated side effects are only triggered once, improving performance and reducing unnecessary re-renders.Reactter.untracked
hepls to execute the givencallback
function without tracking any state changes. This means that any state changes that occur inside thecallback
function will not trigger any side effects.
- refactor(framework): Refactor lifecycle event handling and add lifecycle observer interface.
- Add
LifecycleObserver
inteface for event handling of the instance. - Add
didUnmount
lifecycle.
- Add
- refactor(core, framework, types): Add
LogLevel
enum and updatedefaultLogWriterCallback
signature. - refactor(hooks): Improve
UseEffect
performance and readability.- Add
UseEffect.runOnInit
constructor to execute callback effect on initialization.
- Add
- feat(framework, widgets): Add
ReactterProvider.lazy
constructor for lazy instance initialization. - refactor(widgets): Add
id
property toReactterComponent
for debugging information.
Breakings #
- refactor(extensions, hooks, objs, signals): Remove features deprecated.
- Remove
List<ReactterState>.when
, usecontext.select
orUseCompute
instead. - Remove
UseContext
, useUseInstance
instead. - Remove
UseEvent
, use event shortcuts instead. - Remove
initialState
andreset
fromUseState
. - Remove
.obj
, useObj
class instead. - Remove
.signal
, useSignal
class instead.
- Remove
- refactor(framework, widgets, test): Change the position of
InstanceContextBuilder
(InstanceChildBuilder
now) arguments.- Move
context
to first argument onInstanceContextBuilder
(InstanceChildBuilder
now). - Adapt the
InstanceContextBuilder
(InstanceChildBuilder
now) ofReactterComponent
,ReactterConsumer
andReactterProvider
widgets.
- Move
- refactor(core, hooks): Rename
attachTo
tobind
,detachInstance
tounbind
andinstanceAttached
toinstanceBinded
. - refactor(hooks): Improve
UseEffect
performance and readability.
Fixes #
- fix(obj): Fix equality comparison in
ObjBase
class. - fix(core): Resolve event for both types(instanceRef, instanceObj) and log event error.
- fix(core): Find the instance registered by the instance manager when searching for the extended class.
- refactor(core): Fix out-of-bounds index on
getHashCodeRefAt
method.
Internal #
- refactor(framework, widgets, test): Change the position of
InstanceContextBuilder
(InstanceChildBuilder
now) arguments.- Adjust the tests about
ReactterComponent
,ReactterConsumer
andReactterProvider
widgets. - Adjust the documentation about
ReactterComponent
,ReactterConsumer
andReactterProvider
widgets.
- Adjust the tests about
- refactor(framework, widgets, test): Improve framework structure and simplify the
ReactterProvider
code.- Remove
Reactter
prefix of the framework classes. - Add
ProviderBase
,ProviderImpl
,ProviderElement
andProviderRef
class. - Rename
InstanceContextBuilder
toInstanceChildBuilder
andInstanceValueBuilder
toInstanceValueChildBuilder
. - Add
ChildBuilder
type. - Add
Reactter.getHashCodeRef
method.
- Remove
- refactor: Refactor file structure and imports.
- refactor(core, framework, hooks, signal): Rename variables of
ReactterZone
and improveReactterState
implementation. - refactor(test): Add
lazyState
,untracked
andbatch
tests. - refactor(core, test): Fix lifecycle event handling and add lifecycle_observer test.
- refactor(core, framework, test): Refactor event manager and remove unused code for 100% coverage.
- refactor(core, framework): Add
BindingZone
class and update references. - fix(core): Fix generic type constraint in
_getInstanceRef
method. - refactor(core): Refactor event handling logic and optimize listener removal.
- test(core, hooks): Add tests for signal usage on instance and binding to another instance.
- test(widgets): Add
ReactterProvider.lazy
tests, updateReactterComponent
tests and addLifecycleObserver
toTestController
. - fix(example): Update dependencies and fix code formatting on examples.
6.2.0 #
6.1.0 #
Enhancements #
- feat(framework, widgets, extensions): Add
ReactterSelector
widget andcontext.select
method extension.ReactterSelector
andcontext.select
help to control the rebuilding of widget tree using aSelector
methods that allows to select a state specific for listening, and return a computed value.
- feat(widgets): Add
ReactterScope
Widget. IfReactterProvider.contextOf
doesn't have a type defined, useReactterScope
to work correctly.
Breakings #
- perf(framework): Remove
updateAsync
fromReactterHook
andReactterState
. - perf(framework): Remove
emitAsync
fromReactterEventManager
. - refactor(extensions): Deprecate
List<ReactterState>.when
, usecontext.select
orUseCompute
instead.
Fixes #
- fix(widgets): Notify
ReactterWatcher
has changed when available. - fix(framework): Remove
UseWen
asynchronously when callmarkNeedsNotifyDependents
through its changes.
Internal #
- perf(framework): Add
ReactterNotifier
to manage events. - refactor(widgets): Improve
ReactterProvider
code. - perf(extensions, framework, widgets): Improve performance of
context.watch
. - refactor(types): Add
WatchState
andSelectComputeValue
types. - refactor(framework): Improve message error about
notifyListeners
ofReactterNotifier
. - feat(framework, widgets, extensions): Improve managing dependency.
- test(framework, widgets, hooks): Fix some part for test coverage.
- test: Add
context.select
andReactterSelector
test. - doc: Fix some code documentation.
- refactor(example): Improve api example.
- doc: Add documention about new features.
6.0.0 #
Enhancements #
- feat(args): Implement generic arguments.
- Add the
Args
class which represent one or more arguments. - Add the
Args1
,Args2
andArgs3
classes which represent one, two and three arguments respectively. - Add the types
ArgsX2
andArgsX3
which representArgs2
andArgs3
with the same arguments type. - Add
ary
methods for converting Function to Function with generic arguments.
- Add the
- feat(memo): Implement the
Memo
class. It's used for memoizing values returned by a calcutate function. - feat(memo): Add
MemoInterceptors
,MemoInterceptor
andMemoInterceptorWrapper
for intercepting and handling various events during the memoization process. - feat(memo): Add
AsyncMemoSafe
for removing the memoized value if its futures that throw an error when executed. - feat(memo): Add
TemporaryCacheMemo
for removing memoized values from the cache after a specified duration. - feat(framework, widgets):Improve
ReactterInstanceManager
andReactterInstance
.- Add
ref
parameter toReactter.get
. - Add
Reactter.destory
. - Add
InstanceManageMode.builder
,InstanceManageMode.factory
andInstanceManageMode.singleton
enums. These types represent different ways of creating and managing instances. - Add
Reactter.getInstanceManageMode
method for getting the instance type of the instance specified. - Add
Reactter.isRegistered
method for check if an instance is registered in Reactter. - Add
Reactter.lazyBuilder
,Reactter.lazyFactory
,Reactter.lazySingleton
methods to register a builder function to create a new instance in one of the different types. - Add
Reactter.builder
,Reactter.factory
,Reactter.singleton
methods to create a new instance in one of the different types. - Add
type
property toReactterProvider
.
- Add
- feat(hooks): Improve
UseInstance
hook.- Add
UseInstance.register
constructor for registering the builder function when it instantiated. - Add
UseInstance.create
constructor to create an instancia when it instantiated. - Add
UseInstance.get
constructor to create and/or get an instancia when it instantiated. - Add
UseInstance.lazyBuilder
,UseInstance.lazyFactory
,UseInstance.lazySingleton
factories to register a builder function to create a new instance in one of the different types when it instantiated. - Add
UseInstance.builder
,UseInstance.factory
,UseInstance.singleton
factories to create a new instance in one of the different types when it instantiated.
- Add
Breakings #
- refactor(framework): Replace
Reactter.instanceOf
toReactter.find
. - refactor(framework): Change builder parameter of
Reactter.register
andReactter.create
to positional parameter. - refactor(hooks): Add
UseAsyncState.withArg
for usingUseAsyncState
withArgs
.- Now, the
resolve
method ofUseAsyncState
is used without arguments. Replace withUseAsyncState.withArg
. Itsresolve
method allows to use arguments.
- Now, the
- refactor(hooks, example): Deprecate
UseState.initial
andUseState.reset
.- Avoid using it.
- refactor(hooks): Deprecate
UseEvent
hook.- Use event shortcuts instead.
- refactor(hooks, test): Deprecate
UseContext
hook.- Use manage instances shortcuts or
UseInstance
instead.
- Use manage instances shortcuts or
- refactor(framework): The
Reactter.unregister
couldn't deregister the instance builder when the instance is active. - refactor(framework): Rename
Reactter.dispose
toReactter.offAll
. - refactor(types): Rename
ContextBuilder
toInstanceBuilder
andInstanceBuilder
toInstanceContextBuilder
. - reactor(framework): Rename
Reactter.lazy
toReactter.lazyState
.
Internal #
- refactor(framework, hooks, test): Improve code structure and how to attach an instance to states using
ReactterZone
and structure code ofReactterState
. - refactor(example): Improve examples using the new features.
- test(framework, widgets, hooks): Add some tests about
ReactterInstanceManager
,ReactterInstance
,UseInstance
- test(framework): Improve tests.
- test(framework): Add
Reactter.destroy
test. - test(memo): Add
Memo
andMemoInterceptor
test. - test(args): Add
Args
test. - test(hooks): Add
UseAsyncState.withArg
test. - test(hooks): Add
UseInstance
test. - fix(test): Fix grammar of test description.
5.1.2 #
5.1.0 #
Enhancements #
- feat(framework): Implement hook register.
- Add hook register logic for attaching
ReactterState
defined intoReactterHook
. - Refactor hooks to implement hook register.
- Add hook register logic for attaching
- feat(framework): Add
lazy
method and makeisInstanceBuilding
variable as public. - feat(extensions): Add
ReactterStateListExtension
withwhen
method. - feat(hooks): Add
UseCompute
hook. - feat(widget, test): Add
ReactterConsumer
widget.
Internal #
- build(example): Use
reactter_lint
. - build(widgets): Remove unnecesary import.
- doc: Fix
ReactterInstanceNotFoundException
documentation. - refactor(framework): Export
ReactterInstance
. - doc(example): Add and remove some concepts from main.
- refactor(example): Remove late keyword form some hooks.
- refactor(example): Implement play and stop animation.
- refactor(framework): Rename
_RegisterHook
toHookRegister
. - test: Add
ReactterStateListExtension
test and other adjustments. - refactor(widgets): Make
ReactterConsumer.builder
required. - fix(framework): Add instance attached validation before
UseCompute
is disponsed. - refactor(extensions): Use
UseCompute
type onwhen
method. - test: Add
UseCompute
test and other adjustments. - build(example): Change folder structure.
- build: Change folder structure for
flutter_reactter
package.- Move all files to
src
. - Rename
ReactterTypes
totypes
. engine
was separated intoextensions
,framework
andtypes
.- Change folder structure of
test
.
- Move all files to
- build: Change folder structure for
reactter
package.- Move all files to
src
. - Rename
ReactterTypes
totypes
. core
was separated intoframework
,objs
,signals
,lifecycle
,types
.- Change folder structure of
test
.
- Move all files to
- refactor(core, widgets): Implement Reactter event to Signal generic.
- Remove
ReactterSignalProxy
. - Move
Obj
,Signal
to other folder. - Refactor
ReactterWatcher
to the new changes.
- Remove
- refactor(core): Remove
ReactterNotifyManager
.ReactterNotifyManager
is no longer used, all its methods were moved toReactterState
.Lifecycle
enum was move to new file(lifecycle.dart
).
5.0.1 #
Internal #
- fix(test): Change dependencies for test coverage.
- fix(test): Fix some info about code validator.
5.0.0 #
Breakings #
- refactor(engine, widgets, core, hooks, test): Delete
ReactterContext
andReactterHookManager
and remove all about it. - refactor(widgets, test): Replace
ReactterContextNotFoundException
toReactterInstanceNotFoundException
. - refactor(widgets, test): Remove
listenAllHooks
property fromReactterComponent
, uselistenAll
. - refactor(widgets, test): Remove
listenHooks
property fromReactterComponent
andReactterProvider.contextOf
, uselistenStates
. - refactor(hooks, test): Remove
context
property fromUseAsyncState
,UseContext
,UseEvent
,UseReducer
andUseState
. - refactor(hooks, test): Remove type
ReactterAction
,type
is String. - refactor(core, widgets, test): Delete
ReactterBuilder
andReactterScope
, replace tobuild
,StatelessWidget
,StatefulWidget
or any Widget that exposeBuildContext
.
Enhancements #
- feat(core): Add
attachTo
,detachTo
andcreateState
methods toReactterState
.
Fixes #
- refactor(core): Fix
hasListener
no depend ofReactterNotifyManager
.
Internal #
- refactor, doc(example): Adjust to new changes.
- doc: Change documentation to better readability and adjut to new changes.
4.1.1 #
Fixes #
- fix(core): Fix predispose all hook states.
Internal #
- refactor(example): Minor changes in some examples.
- refactor(example): Improve code and design of tree example.
- refactor(example): Improve code of calculator example.
- refactor(example): Improve code of animation example.
- doc: Add link to examples using zapp
4.1.0 #
Enhancements #
- perf(core): Improve performance for changing states.
- perf(engine): Improve management for context dependencies.
Fixes #
- fix(core): Remove the callbacks of one events when the instance will be disposed.
Internal #
- refactor(example): Improve examples and fix some bugs.
- doc: Fix documentation.
4.0.0 #
Enhancements #
- feat(core): Add
Obj
. - feat(core): Add
Signal
. - feat(core): Add
ReactterSignalProxy
mixin. - feat(core): Add
ReactterNotifyManager
mixin. - feat(core): Add
ReactterState
mixin. - refactor(core,hooks): Manage event separate from
UseEvent
hook. - perf(core): Improve to manage instances.
- perf(core): Improve to manage state.
- perf(widgets,core): Improve performance on
ReactterProvider
. Now there is no need to useReactterComponent
orReactterBuilder
. The instance can be accessed directly from the context(BuildContext
) and just the part belonging to the context is re-built. - feat(widgets): Add
ReactterWatcher
. You can use theSignal
variable inReactterWatcher
and react when it changed forReactterWatcher
's widgets rebuild.
Breakings #
- refactor(core): Remove
typedef
innecesary. - refactor(hooks): Fix dispose of
UseContext
andUseEffect
. - build(widgets): Mark
ReactterScope
as deprecated. Use any Widget that exposes theBuildContext
likeBuild
,StatelessWidget
orStatefulWidget
instead. - build(widgets): Mark
listenHooks
andlistenAllHooks
as deprecated. UselistenStates
andlistenAll
instead. - refactor(widgets): Remove
onInit
fromReactteProvider
andReactterComponent
. - refactor(widget): Add
ReactterContext
argument inbuilder
ofReactterProvider
.
Fixes #
- fix(core): Don't allow increasing listeners count, if event don't exist.
- fix(widgets): Clear previous signals saved.
- fix(core): Remove one callback using off method and was changed how to storage event.
Internal #
- test: Refactor test and add event manager test.
- refactor(test): Fix test and add new tests.
- build(engine): Rename some files.
- refactor(test): Fix test and add
ReactterWatcher
test. - refactor(examples): Improve examples code and add calculator example.
- doc: Fix documentation and add new documentation.
- test(core,hooks): Fix dispose on some tests.
- refactor(examples): Do counter more simple.
3.2.1-dev.2 #
Enhancements #
- refactor(engine): Use
ReactterScopeInheritedElement
as mixin onReactterProviderInheritedElement
. - perf(widget): Improve
ReactterBuilder
performance.
3.2.0 #
Enhancements #
- feat(hooks): Add
UseReducer
hook.
Breakings #
- refactor(core): Replace
ReactterInstanceManager
extension to class.
Fixes #
- refactor(hooks): Move events storage variable.
Internal #
- refactor(examples): Improve examples code.
- docs: Update roadmap.
- docs: Fix some typos and improve documentation.
3.1.1 #
Fixes #
- fix(widgets): Fix
child
andbuilder
ofReactterProvider
is not required when useReactterProviders
.
3.1.0 #
Breakings #
- refactor(core): Remove selector aspect from
ReactterProvider.of
.
Fixes #
- fix(core): Fix
ReactterInstanceManager
's get method create instance when instance didn't create yet. - refactor(engine, widgets): Add validations about
child
andbuilder
properties.
Enhancements #
- refactor(core): Change
Reactter.delete
named argument to positional argument.
Internal #
- docs: Fix README documentation.
- refactor(tests): Add test coverage of 100%.
3.0.0 #
Breakings #
- 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
.
Enhancements #
- 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). - 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 #
Internal #
- fix(example): Fix typo on counter example button.
- fix(example): Add implement tags on animation example.
2.3.0 #
Breakings #
- 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(widgets): Use
ReactterInheritedProvider
as scope onReactterBuilder
. - refactor(widgets): Add
ReactterBuilder
as scope when didn't has builder onReactterComponent
. - 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 listened to mark need build. - refactor(hooks, widgets) - Rename
UseProvide
toReactterProvider
.
Fixes #
- fix(hooks,widgets): Delete instances of
UseContext
when dispatch updated event onReactterProvider
, to prevent has instances duplicated. - refactor(widget): Fix
ReactterBuilder
.
Enhancements #
- feat(widgets): Send
id
for findReactterContext
onReactterComponent
. - 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
. - refactor(core): Remove context property as public on
ReactterHook
. - feat(engine): Remove dependencies when
ReactterProvider
unmount. - refactor(core): Remove unnecessary event listeners from
ReactterContext
. - refactor(core,hooks): Remove unnecessary code.
- refactor(engine): Remove props unnecessary on
ReactterInheritedProvider
. - refactor(hooks): Clear code and do code simple on
UseAsyncState
. - refactor(core): Improve performance how instances manager on
ReactterFactory
. - 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 uses as subscription.
Internal #
- docs: Fix some documentation.
- feat(example): Add more example with animation.
- feat(example): Add new examples.
- docs: Add badgets, reorder topic, fix examples and improve redaction on README.
- docs: Add more documentation.
- tests: Add tests for
hooks
andWidgets
.
1.0.1 #
1.0.0 #
Enhancements #
-
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. -
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. }
Internal #
- Fix some documentation.
- Package description (was too short).
- Remove unused imports in library.
- Documentation
- 130 points in pub.dev.
1.0.0-dev #
Enhancements #
-
Controller now is Context:
ReactterController
has been replaced byReactterContext
, which are the classes that going to manage our states.class AppContext extends ReactterContext {}
Internal #
- No need package dependencies: We decided to remove all dependencies and create a new state management from scratch.