mapToCookie function

String mapToCookie(
  1. Map<String, String> cookies
)

Converts a map of cookies to a string.

Implementation

String mapToCookie(Map<String, String> cookies) {
  List<String> cookieList = [];
  cookies.forEach((key, value) {
    cookieList.add('$key=$value');
  });
  String cookieStr = cookieList.join(', ').trim();
  if (cookieStr != "") {
    return cookieStr;
  } else {
    return "";
  }
}