tablexStrings function
Returns the TablexStrings instance for the current locale.
Locale resolution order:
- Localizations.maybeLocaleOf — the app's locale (set via
MaterialApp.localeor a localization delegate). PlatformDispatcher.instance.locale— the device system locale.- English, as a hard fallback.
Call this inside build() — it is a cheap map lookup.
@override
Widget build(BuildContext context) {
final t = tablexStrings(context);
return Text(t.noData);
}
Implementation
TablexStrings tablexStrings(BuildContext context) {
final locale = Localizations.maybeLocaleOf(context) ??
PlatformDispatcher.instance.locale;
return TablexStrings.of(TablexLocale.fromLocale(locale));
}