parameters property

Map<String, String> parameters

A map representing the parameters of the media type.

A data URI may contain parameters between the MIME type and the data. This converts these parameters to a map from parameter name to parameter value. The map only contains parameters that actually occur in the URI. The charset parameter has a default value even if it doesn't occur in the URI, which is reflected by the charset getter. This means that charset may return a value even if parameters["charset"] is null.

If the values contain non-ASCII values or percent escapes, they are decoded as UTF-8.

Implementation

Map<String, String> get parameters {
  var result = <String, String>{};
  for (int i = 3; i < _separatorIndices.length; i += 2) {
    var start = _separatorIndices[i - 2] + 1;
    var equals = _separatorIndices[i - 1];
    var end = _separatorIndices[i];
    String key = _Uri._uriDecode(_text, start, equals, utf8, false);
    String value = _Uri._uriDecode(_text, equals + 1, end, utf8, false);
    result[key] = value;
  }
  return result;
}

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.13.0/dart-core/UriData/parameters.html