Skip to content

RPLocalizationsDelegate

Inheritance

Constructors

RPLocalizationsDelegate

RPLocalizationsDelegate({
  1. required List<LocalizationLoader> loaders,
})

Create a RPLocalizationsDelegate.

loaders specify a list of LocalizationLoader which each can load different translations. Translations from all loaders are merged. Potential duplicate translation keys are overwritten in the order of the list of loaders.

Properties

loaders

List<LocalizationLoader> loaders
final

Methods

isSupported

bool isSupported(
  1. Locale locale
)
override

Whether resources for the given locale can be loaded by this delegate.

Return true if the instance of T loaded by this delegate's load method supports the given locale's language.

load

Future<RPLocalizations> load(
  1. Locale locale
)
override

Start loading the resources for locale. The returned future completes when the resources have finished loading.

It's assumed that this method will return an object that contains a collection of related string resources (typically defined with one method per resource). The object will be retrieved with Localizations.of.

reload

void reload()

Mark that this delegate should reload its translations. Useful if, for example, downloaded from the network.

shouldReload

bool shouldReload(
  1. covariant RPLocalizationsDelegate old
)
override

Returns true if the resources for this delegate should be loaded again by calling the load method.

This method is called whenever its Localizations widget is rebuilt. If it returns true then dependent widgets will be rebuilt after load has completed.