supportedLocales property
This parameter is ONLY needed if the child parameter is not MaterialApp or CupertinoApp.
Note: MaterialApp or CupertinoApp and this widget should still be inside the
same build
method, otherwise it will not listen to locale
notifier!
Example:
Widget build(BuildContext context) {
return LocaleManager(
child: MaterialApp(
locale: LocaleSwitcher.current.locale,
supportedLocales: AppLocalizations.supportedLocales,
Another Example:
Widget build(BuildContext context) {
return LocaleManager(
supportedLocales: AppLocalizations.supportedLocales, // in this case it required
child: SomeOtherWidget(
child: MaterialApp(
locale: LocaleSwitcher.current.locale,
supportedLocales: AppLocalizations.supportedLocales,
Implementation
final List<Locale>? supportedLocales;