getErrorMessage function

String getErrorMessage(
  1. dynamic error
)

Get a string description of an exception.

Many exceptions include the exception class name at the beginning of their toString, so we remove that if it exists.

Implementation

String getErrorMessage(error) =>
    error.toString().replaceFirst(_exceptionPrefix, '');