of static method
By passing context
, the FunctionsAdapter set in FunctionsAdapterScope can be obtained.
If the ancestor does not have FunctionsAdapterScope, an error will occur.
context
を渡すことによりFunctionsAdapterScopeで設定されたFunctionsAdapterを取得することができます。
祖先にFunctionsAdapterScopeがない場合はエラーになります。
Implementation
static FunctionsAdapter? of(BuildContext context) {
final scope = context
.getElementForInheritedWidgetOfExactType<_FunctionsAdapterScope>();
assert(
scope != null,
"FunctionsAdapterScope is not found. Place [FunctionsAdapterScope] widget closer to the root.",
);
return (scope?.widget as _FunctionsAdapterScope?)?.adapter;
}