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