errorToString method
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();
}