I have a problem with my app...I can not get the correct current Locale of my app.
This:
print(Localizations.localeOf(context));
is always giving me:
en_US
but I am actually in Germany. I tried it on both Android and iPhone Simulator as well as on a real device. It is always giving me "en_US" :(
I create my MaterialApp like this:
MaterialApp(
title: 'ProjectX',
theme: ThemeData(
primarySwatch: ColorService.createMaterialColor(AppColors.secondary),
backgroundColor: AppColors.white,
scaffoldBackgroundColor: AppColors.white,
visualDensity: VisualDensity.adaptivePlatformDensity,
fontFamily: AppTextStyles.mainFont,
),
initialRoute: isOnline
? showOnboarding
? '/onboarding'
: '/'
: '/offline',
onGenerateRoute: AppRouter.generateRoute,
locale: Locale('de', 'DE'),
localizationsDelegates: [
AppLocalizationsDelegate(),
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
DefaultCupertinoLocalizations.delegate,
],
),
Is this a known bug? What am I missing here?