of static method
The WidgetsLocalizations
from the closest Localizations instance
that encloses the given context.
This method is just a convenient shorthand for:
Localizations.of<WidgetsLocalizations>(context, WidgetsLocalizations)!
.
References to the localized resources defined by this class are typically written in terms of this method. For example:
textDirection: WidgetsLocalizations.of(context).textDirection,
Implementation
static S? of(BuildContext context) => Localizations.of<S>(context, S);