of<T extends InheritedWidget> static method

T? of<T extends InheritedWidget>(
  1. BuildContext context, {
  2. bool listen = true,
})

Find widget in tree

Implementation

static T? of<T extends InheritedWidget>(BuildContext context,
    {bool listen = true}) {
  if (listen) {
    return context.dependOnInheritedWidgetOfExactType<T>();
  } else {
    return context.findAncestorWidgetOfExactType<T>();
  }
}