setLocale static method

void setLocale(
  1. String? localeStr
)

Use this to set the locale used by method titleAndContent to translate the text "Reason:" used to explain the chain of reasons in the UserException.

If you remove the locale with setDefaultLocale(null), the default will be English of the Unites States.

Note: This uses the i18n_extension_core package from https://pub-web.flutter-io.cn/packages/i18n_extension_core

IMPORTANT: If you already use i18n_extension_core (in your Dart-only code) or i18n_extension (in your Flutter app), there is no need to ever call UserException.setLocale, because the locale will already have been set.

Implementation

static void setLocale(String? localeStr) => DefaultLocale.set(localeStr);