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

Why when creating a Consumer, an optional child is asked? When is it used? #878

Closed
stephane-archer opened this issue Apr 28, 2024 · 2 comments
Assignees
Labels
documentation An opportunity for improving the documentation needs triage

Comments

@stephane-archer
Copy link

Why when creating a Consumer, an optional child is asked? When is it used? The builder is what decides what is shown from my understanding.

(new) Consumer<VideoCodecChangeNotifier> Consumer({
  Key? key,
  required Widget Function(BuildContext, VideoCodecChangeNotifier, Widget?) builder,
  Widget? child,
})
@stephane-archer stephane-archer added documentation An opportunity for improving the documentation needs triage labels Apr 28, 2024
@Melvin-2007
Copy link

The child widget passed to the Consumer won't rebuild when the value changes. This allows you to include widgets inside the child that you don't want to rebuild when the value changes.

@rrousselGit
Copy link
Owner

This is explained by the IDE documentation of the Consumer class.

See also: https://pub.dev/documentation/flutter_riverpod/latest/flutter_riverpod/Consumer-class.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation An opportunity for improving the documentation needs triage
Projects
None yet
Development

No branches or pull requests

3 participants