getString static method
Retrieves a localized string for the given stringId.
If useDefaultString is true and the string ID is not found in the current language,
the default string (in english) will be returned instead of an empty string.
If the string ID does not exist, an empty string is returned.
The localization is based on the current SdkSettings.language setting.
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.
Also see:
- getStrings - Retrieve multiple localized strings at once.
- SdkSettings.language - Current language setting for localization.
Implementation
static String getString(final int stringId, {bool useDefaultString = false}) {
final OperationResult resultString = staticMethod(
'Localization',
'getString',
args: <String, Object>{
'stringId': stringId,
'useDefaultString': useDefaultString,
},
);
return resultString['result'];
}