rrousselGit / riverpod

A reactive caching and data-binding framework. Riverpod makes working with asynchronous code a breeze.
https://riverpod.dev
MIT License
6.32k stars 961 forks source link

What makes dynamically creating providers unsupported feature? #3655

Closed htetlynnhtun closed 4 months ago

htetlynnhtun commented 4 months ago

Is your feature request related to a problem? Please describe. Let's imagine a twitter post. In the paginated infinite scrolling list, each post may have an avatar, username, image, comment count, repost count, like count. A postItemProvider could handle the name and the counts. But for the avatar and image, they have their own changing state (loading->loaded|failure) and business logics e.g cancelling the image request if the post item is scrolled out of view while the images are loading. So for each post, we need postItemProvider and one or more imageProvider.

Describe the solution you'd like Should be able to create providers for each post dynamically and dispose them whenever it is appropriate to

Describe alternatives you've considered Can't figure out alternatives.

rrousselGit commented 4 months ago

For general help request, consider Discord instead. This is for feature requests/bug reports.

But TL;DR, it can easily lead to memory leaks. And it's straight up not really feasible when using the latest syntax