toString method

  1. @override
String toString([
  1. Map? args
])
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([Map? args]) {
  //arguments ??= args;
  if (playerName != null && playerName!.isNotEmpty) return playerName!;
  var ret = '@$selector';

  if (arguments.isNotEmpty) {
    ret += '[';
    for (var key in arguments.keys) {
      if (arguments[key] is List) {
        arguments[key].forEach((item) {
          ret += _addArg(item, key);
          if (item != arguments[key].last) ret += ',';
        });
        if (key != arguments.keys.last) ret += ',';
      } else {
        ret += _addArg(arguments[key], key);
        if (key != arguments.keys.last) ret += ',';
      }
    }
    ret += ']';
  }
  return ret;
}