scenario where using findAncestorWidgetOfExactType() will lead to failure to rebuild
143 views
Skip to first unread message
Kent Tong
unread,
Mar 22, 2020, 5:47:35 AM3/22/20
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Flutter Development (flutter-dev)
Hi,
I understand using an InheritedWidget is recommended over findAncestorWidgetOfExactType() when a widget depends on an ancestor widget. However, I can't think of a scenario where findAncestorWidgetOfExactType() will lead to failure to rebuild. If as a widget is read-only, the only way it changes is when it is replaced by a new one. Then the whole subtree will be rebuilt and so the descendant widget will be replaced by a new one and its element will be updated. Am I missing something?