titleAndContent method

  1. @useResult
(String, String) titleAndContent()

Based on the message, code and reason, returns the title and content to be used in some UI to show the exception the user. The UI is usually a dialog or toast.

If the exception has both a message an a reason, the title will be the message, and its content will be the reason. Otherwise, the title will be empty, and the content will be the message.

Alternatively, if you provide a numeric code instead of a message, the text will be the one associated with the code (see translateCode and codeTranslations) for more details.

Implementation

@useResult
(String, String) titleAndContent() {
  if (_ifHasMsgOrCode()) {
    if (reason == null || reason!.isEmpty)
      return ('', _msgOrCode());
    else
      return (_msgOrCode(), reason ?? '');
  }
  //
  else if (reason != null && reason!.isNotEmpty)
    return ('', reason ?? '');
  //
  else
    return ('User Error', '');
}