Skip to content
New issue

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

context.select in ProxyProvider0.update not allowed? #875

Open
taosimple opened this issue Apr 19, 2024 Discussed in #873 · 1 comment
Open

context.select in ProxyProvider0.update not allowed? #875

taosimple opened this issue Apr 19, 2024 Discussed in #873 · 1 comment
Labels
enhancement New feature or request

Comments

@taosimple
Copy link

Discussed in #873

Originally posted by taosimple April 19, 2024

ProxyProvider0<TransformedCounter>(
          update: (context, value) {
            final value = context.select<Counter, int>((counter) => counter.value);
            return TransformedCounter(value * 2);
          },
        ),

ProxyProvider0<TransformedCounter>(
          update: (context, value) {
            final counter = context.watch<Counter>();
            return TransformedCounter(counter.value * 2);
          },
        ),

Above codes use context.select will throw a exception: Tried to use context.select outside of the build method of a widget., but use context.watch is fine, why context.select is not allowed, it more efficient than context.watch.

@rrousselGit
Copy link
Owner

Technical limitation. We could possibly support it, but that's not a thing yet.

@rrousselGit rrousselGit added the enhancement New feature or request label Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants