Commit 1e1bed1e authored by Adam Barth's avatar Adam Barth Committed by GitHub

Add an example for BuildContext.ancestorStateOfType (#6953)

parent 39872e7d
...@@ -1512,6 +1512,12 @@ abstract class BuildContext { ...@@ -1512,6 +1512,12 @@ abstract class BuildContext {
/// Calling this method is relatively expensive (O(N) in the depth of the /// 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 /// tree). Only call this method if the distance from this widget to the
/// desired ancestor is known to be small and bounded. /// desired ancestor is known to be small and bounded.
///
/// Example:
///
/// ```dart
/// context.ancestorStateOfType(const TypeMatcher<ScrollableState>());
/// ```
State ancestorStateOfType(TypeMatcher matcher); State ancestorStateOfType(TypeMatcher matcher);
/// Returns the [RenderObject] object of the nearest ancestor [RenderObjectWidget] widget /// Returns the [RenderObject] object of the nearest ancestor [RenderObjectWidget] widget
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment