From 532aa3ad4768c02597ef2f05fa6649ae31039663 Mon Sep 17 00:00:00 2001 From: Ian Hickson Date: Fri, 14 Jul 2023 16:37:10 -0700 Subject: [PATCH] Consistency in dependOnInheritedWidgetOfExactType guidance (#130632) Fixes https://github.com/flutter/flutter/issues/47067 --- packages/flutter/lib/src/widgets/framework.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/flutter/lib/src/widgets/framework.dart b/packages/flutter/lib/src/widgets/framework.dart index c6d8f056fd43..2331ea9d31d0 100644 --- a/packages/flutter/lib/src/widgets/framework.dart +++ b/packages/flutter/lib/src/widgets/framework.dart @@ -993,7 +993,7 @@ abstract class State with Diagnosticable { /// /// {@endtemplate} /// - /// You cannot use [BuildContext.dependOnInheritedWidgetOfExactType] from this + /// You should not use [BuildContext.dependOnInheritedWidgetOfExactType] from this /// method. However, [didChangeDependencies] will be called immediately /// following this method, and [BuildContext.dependOnInheritedWidgetOfExactType] can /// be used there. @@ -2240,7 +2240,8 @@ abstract class BuildContext { /// again if the inherited value were to change. To ensure that the widget /// correctly updates itself when the inherited value changes, only call this /// (directly or indirectly) from build methods, layout and paint callbacks, - /// or from [State.didChangeDependencies]. + /// or from [State.didChangeDependencies] (which is called immediately after + /// [State.initState]). /// /// This method should not be called from [State.dispose] because the element /// tree is no longer stable at that time. To refer to an ancestor from that