urlEncodeMap static method

String urlEncodeMap(
  1. Map<String, dynamic> map, [
  2. ListFormat listFormat = ListFormat.multi
])

Recursively encode the Map<String, dynamic> to percent-encoding. Generally used with the "application/x-www-form-urlencoded" content-type.

Implementation

static String urlEncodeMap(
  Map<String, dynamic> map, [
  ListFormat listFormat = ListFormat.multi,
]) {
  return encodeMap(
    map,
    (key, value) {
      if (value == null) {
        return key;
      }
      return '$key=${Uri.encodeQueryComponent(value.toString())}';
    },
    listFormat: listFormat,
  );
}