Skip to content

[3.2.0] [flutter_riverpod] Regression in rebuilding ProviderScope at the start of every frame #4661

Description

@s9th

Describe the bug
I have a page in a PageView with a list of items, each of which is wrapped with a ProviderScope.
After PageView switches to another page and animation is finished, the following error appears for every ProviderScope that was on the screen.

I/flutter (17696): │ ⛔ The following assertion was thrown during a scheduler callback:
I/flutter (17696): │ ⛔ setState() called after dispose():
I/flutter (17696): │ ⛔ _UncontrolledProviderScopeState#2cdc7(lifecycle state: defunct,
I/flutter (17696): │ ⛔ not mounted)

Stack trace points to this line

I believe this bug is the result of this commit in effort to fix markNeedsBuild errors
defa32e

Maybe a mounted check should be enough to fix it

To Reproduce

Unfortunately I have no way to create a small reproducible sample until the end of the week. Maybe someone else can chime in

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions