Skip to content

Widget module not properly disposed on modular 4.x.x #632

@MarcoAFC

Description

@MarcoAFC

Something changed between modular 3.x.x and 4.x.x when dealing with disposing of binds on widget modules, previously all binds and controllers would be removed when a widget was removed from the tree, and now that no longer happens

I've only tested this in depth on widget modules, not sure if there's been any difference on how regular modules deal with disposing binds

Environment

I'm running flutter 2.5.3, stable, shouldn't make much of a difference

To Reproduce

I've built a small POC showcasing this behavior: https://github.com/MarcoAFC/modular_widget_module_test

Branch modular_4.x.x runs on modular 4, and branch modular_3.x.x runs on modular 3, everything else is identical

Expected behavior

I believe widget modules should dispose (and log the disposing on console) when widgets are removed from the tree, as it used to be

Screenshots

Here's what happens on modular 3:

Modular.3.x.x.mp4

And on modular 4:

Modular.4.x.x.mp4

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions