In a Widget build method, which context is the right one to refer to?
When working with Flutter, should you always prefer the closest BuildContext for doing activities like navigation, checking for mounted, getting parent objects using .of(), or is it more nuanced? Consider as an example where in the build method of a Widget I might have some sub-view or action which is nested within another Context, perhaps by a ValueListenableBuilder: Widget build(BuildContext context) { final theme = Theme.of(context); /* Obvious, since there's only one context */ return Column( children: [ ValueListenableBuilder( valueListenable: vm.isLoading, builder: (innerContext, isLoadi
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.