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 draftToStringMap = {
    draft4: 'http://json-schema.org/draft-04/schema#',
    draft6: 'http://json-schema.org/draft-06/schema#',
    draft7: 'http://json-schema.org/draft-07/schema#',
    draft2019_09: 'https://json-schema.org/draft/2019-09/schema',
    draft2020_12: 'https://json-schema.org/draft/2020-12/schema',
  };
  return draftToStringMap[this]!;
}