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() {
  final buffer = StringBuffer();
  buffer.write('$qtKeyName ');

  if (alt != null) {
    buffer.write(modeStatus(alt!, 'Alt'));
  }

  if (ctrl != null) {
    buffer.write(modeStatus(ctrl!, 'Control'));
  }

  if (shift != null) {
    buffer.write(modeStatus(shift!, 'Shift'));
  }

  if (anyModifier != null) {
    buffer.write(modeStatus(anyModifier!, 'AnyMod'));
  }

  if (ansi != null) {
    buffer.write(modeStatus(ansi!, 'Ansi'));
  }

  if (appScreen != null) {
    buffer.write(modeStatus(appScreen!, 'AppScreen'));
  }

  if (keyPad != null) {
    buffer.write(modeStatus(keyPad!, 'KeyPad'));
  }

  if (appCursorKeys != null) {
    buffer.write(modeStatus(appCursorKeys!, 'AppCuKeys'));
  }

  if (appKeyPad != null) {
    buffer.write(modeStatus(appKeyPad!, 'AppKeyPad'));
  }

  if (newLine != null) {
    buffer.write(modeStatus(newLine!, 'NewLine'));
  }

  if (mac != null) {
    buffer.write(modeStatus(mac!, 'Mac'));
  }

  buffer.write(' : $action');

  return buffer.toString();
}