isGermanLocale function
- dynamic context
Utility functions for handling locale-related operations.
This provides a consistent way to check locale across the application,
avoiding duplicate inline checks like Localizations.localeOf(context) == const Locale('de').
Checks if the current locale is German.
Example:
final filePath = isGermanLocale(context)
? settings.filePathDe
: settings.filePathEn;
Implementation
/// Checks if the current locale is German.
///
/// Example:
/// ```dart
/// final filePath = isGermanLocale(context)
/// ? settings.filePathDe
/// : settings.filePathEn;
/// ```
bool isGermanLocale(BuildContext context) {
return Localizations.localeOf(context) == const Locale('de');
}