toString method

  1. @override
String toString()
override

The string representation of this media type.

Implementation

@override
String toString() {
  List<String> params = parameters.entries
      .map((entry) => "${entry.key}=${entry.value}")
      .toList();
  params.sort((a, b) => a.compareTo(b));
  String paramsStr = "";
  if (params.isNotEmpty) {
    paramsStr = ";" + params.join(";");
  }
  return "$type/$subtype$paramsStr";
}