We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
So I really like where this package is going.
Something I'd like to see is to have dependant cache hold multiple values.
I'd like to build a cache of multiple values, and only compute if that value is new.
For example
string getName(int id) { switch(id) { case 0: return "zero"; case 1: return "one"; .... } } ... int id = 0; final factorialCacheFirst = CachedValue.dependent( on: () => id, compute: () => getName(id), ); // computes final factorialCacheSecond = CachedValue.dependent( on: () => id, compute: () => getName(id), ); // returns cached value id = 1; final factorialCacheThird = CachedValue.dependent( on: () => id, compute: () => getName(id), ); // computes id = 0; final factorialCacheSecond = CachedValue.dependent( on: () => id, compute: () => getName(id), ); // returns cached value id = 1; final factorialCacheThird = CachedValue.dependent( on: () => id, compute: () => getName(id), ); // computes
The summary is I'd love to cache a function's return value for a variety of inputs.
The text was updated successfully, but these errors were encountered:
Your example is a little bit off but I think I get it.
This generally evolves keeping a cache map of dependency and results.
Sorry, something went wrong.
The riverpod family provider is really handy to use for that use-case, until we implement your suggestion here (might not happen).
No branches or pull requests
So I really like where this package is going.
Something I'd like to see is to have dependant cache hold multiple values.
I'd like to build a cache of multiple values, and only compute if that value is new.
For example
The summary is I'd love to cache a function's return value for a variety of inputs.
The text was updated successfully, but these errors were encountered: