toString method Null safety

  1. @override
String toString()
override

Depending on the values of isPending and isSuccess, returns a string to represent the DriverTestMessage.

Used as an alternative method to converting the object to json since RequestData is only accepting string as message.

Implementation

@override
String toString() {
  if (isPending) {
    return 'pending';
  } else if (isSuccess) {
    return 'complete';
  } else {
    return 'error';
  }
}