Skip to content

Add hook to observe didChangeDependencies #397

@water-mizuu

Description

@water-mizuu

Is your feature request related to a problem? Please describe.
Basically, I have a complicated [Widget] which uses [didChangeDependencies] to update state intricately. This involves animations, and with it, comes asynchronous functions. I would like to allow hooks to listen to lifecycle method [didChangeDependencies] as hooks can to [initState] and [dispose], additionally helping parallel the [State] object of [Widgets].

Now, why wouldn't it be applicable to being put in [build] instead? Because I don't want [didChangeDependencies], (and the code inside it) to be run on every [setState]. It should only run when the dependencies it has from providers update.

Describe the solution you'd like
As described above, just modify the [HookElement] mixin to allow listening to [didChangeDependencies] on each hook. I could do this on a local version of the library, but it would be nice to have it as an official change.

Describe alternatives you've considered
None.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions