ancestor<TWidget extends ScopedWidgetBase> method

TWidget ancestor<TWidget extends ScopedWidgetBase>()

O(1) out TWidget in ancestor by passing BuildContext.

If TWidget does not exist in the ancestor, an error is output.

BuildContextを渡して祖先にあるTWidgetをO(1)で取り出します。

祖先にTWidgetが存在しない場合はエラーが出力されます。

Implementation

TWidget ancestor<TWidget extends ScopedWidgetBase>() {
  return ScopedWidgetScope.of(this);
}