errorToString method

String errorToString(
  1. dynamic error
)

Transform a multiline error message to one line only.

Implementation

String errorToString(dynamic error) {
  int index = error.toString().indexOf('\n');
  return (index > 0)
      ? error.toString().substring(0, index)
      : error.toString();
}