urlEncodeMap static method

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

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

Implementation

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