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.

Implementation

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

  return localizationsRepository.getMessage(userMessageId, _args);
}