toString method

  1. @override
String toString()
override

Returns a string representation of the error.

This method is used when the exception is converted to a string, such as when printing to console or logging.

Returns:

  • Formatted error string with the error message

Implementation

@override
String toString() {
  return 'Error: $message';
}