Add an example for BuildContext.ancestorStateOfType (#6953)

This commit is contained in:
Adam Barth
2016-11-21 12:29:01 -08:00
committed by GitHub
parent 39872e7df1
commit 1e1bed1e41

View File

@@ -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<ScrollableState>());
/// ```
State ancestorStateOfType(TypeMatcher matcher);
/// Returns the [RenderObject] object of the nearest ancestor [RenderObjectWidget] widget