From 1e1bed1e41b3a5c4974bac5ff1d5cc9b6a2275a2 Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Mon, 21 Nov 2016 12:29:01 -0800 Subject: [PATCH] Add an example for BuildContext.ancestorStateOfType (#6953) --- packages/flutter/lib/src/widgets/framework.dart | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/flutter/lib/src/widgets/framework.dart b/packages/flutter/lib/src/widgets/framework.dart index bb020127d7..9fc26bf6d6 100644 --- a/packages/flutter/lib/src/widgets/framework.dart +++ b/packages/flutter/lib/src/widgets/framework.dart @@ -1512,6 +1512,12 @@ abstract class BuildContext { /// Calling this method is relatively expensive (O(N) in the depth of the /// tree). Only call this method if the distance from this widget to the /// desired ancestor is known to be small and bounded. + /// + /// Example: + /// + /// ```dart + /// context.ancestorStateOfType(const TypeMatcher()); + /// ``` State ancestorStateOfType(TypeMatcher matcher); /// Returns the [RenderObject] object of the nearest ancestor [RenderObjectWidget] widget