getStrings static method

List<String> getStrings(
  1. List<int> stringIds, {
  2. bool useDefaultString = false,
})

Retrieves multiple localized strings for the given list of stringIds.

If useDefaultString is true and a string ID is not found in the current language, the default string (in english) will be returned instead of an empty string. If a string ID does not exist, an empty string is returned for that ID.

The localization is based on the current SdkSettings.language setting.

Parameters

  • stringIds: A list of string IDs to retrieve.
  • useDefaultString: Whether to return the default string if an ID is not found.

Returns

A list of localized strings corresponding to the given stringIds.

Also see:

  • getString - Retrieve a single localized string.
  • SdkSettings.language - Current language setting for localization. Retrieves a localized TTS string for the given stringId.

If useDefaultString is true and the string ID is not found for the currently selected TTS voice/language, the default string (English) will be returned instead of an empty string. If the string ID does not exist, an empty string is returned.

Parameters

  • stringId: The ID of the string to retrieve.
  • useDefaultString: Whether to return the default string if the ID is not found.

Returns

The localized string corresponding to the given stringId, suitable for TTS.

Also see:

Implementation

static List<String> getStrings(
  final List<int> stringIds, {
  bool useDefaultString = false,
}) {
  final OperationResult resultString = staticMethod(
    'Localization',
    'getStrings',
    args: <String, Object>{
      'stringIds': stringIds,
      'useDefaultString': useDefaultString,
    },
  );

  return List<String>.from(resultString['result']);
}