getUserMessage method

String getUserMessage(
  1. LocalizationsRepository localizationsRepository, {
  2. bool includesCauses = true,

Gets the localized user-facing message for this exception.

@param includesCauses Includes nested UserException causes in the user message when true.


String getUserMessage(LocalizationsRepository localizationsRepository,
    {bool includesCauses = true}) {
  // Convert complex objects to strings, such as Date, to be interpolated.
  List<Object> _args = {
    if (arg is DateTime) {
      return DateFormat.d().add_MMM().add_y().format(arg);
    } else {
      return arg;

  return localizationsRepository.getMessage(userMessageId, _args);