SignalTranslator class
Translator backed by alien_signals. Read translations inside oref's
SignalBuilder (or watch(context, ...)) so widgets rebuild when the
locale changes.
Constructors
- SignalTranslator()
-
factory
Properties
- activeAssetPath → String?
-
Asset path that was actually loaded most recently, or
nullif none could be resolved.no setterinherited - activeLocale → String?
-
Locale file that was actually loaded most recently, or
nullif none could be resolved.no setterinherited - currentLocale → String
-
no setterinherited
- debugObserverAttached → bool
-
no setterinherited
- fallbackLocale ↔ String
-
Locale used to load translations when the requested locale's asset (and
its bare-language variant, if regional) cannot be resolved. Defaults to
'en'. Accepts the same case/separator-tolerant input asloadLocaleand is normalized to canonical form when consulted. If the fallback is itself regional (e.g.'fr_CA'), its bare-language form ('fr') is tried as well — so the full chain on a miss is<requested> → <bare-of-requested> → <fallback> → <bare-of-fallback>, deduplicated. Only canonical asset names (en_GB.json) are probed. SetfallbackLocalebefore the firstloadLocalecall (or bundle a matching asset) to customise it.getter/setter pairinherited - hashCode → int
-
The hash code for this object.
no setterinherited
-
internalTranslations
→ Map<
String, dynamic> -
The currently loaded translation map. Exposed for
translate; don't read from external code — use the adapter'stl/tlv/tlvminstead.no setterinherited -
ready
→ Future<
void> -
Completes once SharedPreferences has loaded and the startup locale has
been applied — the stored locale, or the system locale when none is
stored — so its translations are available.
no setterinherited
- resolvedLocale → String
-
Returns a concrete locale string suitable for APIs that don't understand
the
'sys'sentinel (e.g.intl'sDateFormat, number formatters).no setterinherited - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- systemLocale → String
-
Returns the current locale reported by the operating system.
no setterinherited
- translationsPath ↔ String
-
Asset directory that
<locale>.jsonfiles are loaded from. Defaults to'assets/translations'. To load translations bundled by another package, use Flutter's package asset prefix, e.g.'packages/my_translations/assets/translations'. Trailing slashes are ignored. LikefallbackLocale, set it right after first accessing the translator (before awaiting anything) so the stored locale loaded at startup uses it too.getter/setter pairinherited
Methods
-
debugDetachObserverForTest(
) → void -
inherited
-
detachObserver(
) → void -
Detaches this instance from WidgetsBinding. Adapters call this when
retiring a singleton in
debugReset().inherited -
didChangeAccessibilityFeatures(
) → void -
Called when the system changes the set of currently active accessibility
features.
inherited
-
didChangeAppLifecycleState(
AppLifecycleState state) → void -
Called when the system puts the app in the background or returns
the app to the foreground.
inherited
-
didChangeLocales(
List< Locale> ? locales) → void -
Called when the system tells the app that the user's locale has
changed. For example, if the user changes the system language
settings.
inherited
-
didChangeMetrics(
) → void -
Called when the application's dimensions change. For example,
when a phone is rotated.
inherited
-
didChangePlatformBrightness(
) → void -
Called when the platform brightness changes.
inherited
-
didChangeTextScaleFactor(
) → void -
Called when the platform's text scale factor changes.
inherited
-
didChangeViewFocus(
ViewFocusEvent event) → void -
Called whenever the PlatformDispatcher receives a notification that the
focus state on a view has changed.
inherited
-
didHaveMemoryPressure(
) → void -
Called when the system is running low on memory.
inherited
-
didPopRoute(
) → Future< bool> -
Called when the system tells the app to pop the current route, such as
after a system back button press or back gesture.
inherited
-
didPushRoute(
String route) → Future< bool> -
Called when the host tells the application to push a new route onto the
navigator.
inherited
-
didPushRouteInformation(
RouteInformation routeInformation) → Future< bool> -
Called when the host tells the application to push a new
RouteInformation and a restoration state onto the router.
inherited
-
didRequestAppExit(
) → Future< AppExitResponse> -
Called when a request is received from the system to exit the application.
inherited
-
handleCancelBackGesture(
) → void -
Called when a predictive back gesture is canceled, indicating that no
navigation should occur.
inherited
-
handleCommitBackGesture(
) → void -
Called when a predictive back gesture is finished successfully, indicating
that the current route should be popped.
inherited
-
handleStartBackGesture(
PredictiveBackEvent backEvent) → bool -
Called at the start of a predictive back gesture.
inherited
-
handleStatusBarTap(
) → void -
Called when the user taps the status bar on iOS, to scroll a scroll
view to the top.
inherited
-
handleUpdateBackGestureProgress(
PredictiveBackEvent backEvent) → void -
Called when a predictive back gesture moves.
inherited
-
loadLocale(
String locale) → Future< void> -
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
debugReset(
) → void -
Swaps the singleton for a fresh instance so tests start from a clean
slate without needing to reset fields by hand. The previous instance's
WidgetsBindingObserverregistration is detached so observers don't accumulate across tests.