toString method

  1. @override
String toString()
override

A string representation of this object.

Some classes have a default textual representation, often paired with a static parse function (like int.parse). These classes will provide the textual representation as their string representation.

Other classes have no meaningful textual representation that a program will care about. Such classes will typically override toString to provide useful information when inspecting the object, mainly for debugging or logging.

Implementation

@override
String toString() {
  return buildString((str) {
    str += "FormSubmitResult{ \n";
    str += "  result: $resultType\n";
    final duration = (end.difference(start));
    str += "  duration: ${duration.format()}\n";
    if (message != null) str += message;
    if (subforms.isNotEmpty) str += "  subforms => \n";
    subforms.forEach((key, result) {
      str += "    $key: ${result.resultType}\n";
    });
    if (submitHooks.isNotEmpty) str += "  submitHooks => \n";
    submitHooks.forEach((key, result) {
      str += "    $key: ${result.resultType}\n";
    });
    if (allResults.isNotEmpty) str += "  model => \n";
    allResults.forEach((value) {
      str += "    ${value.runtimeType}: $value\n";
    });

    str += "}";
  });
}