GetCookie function

String GetCookie(
  1. String key
)

Implementation

String GetCookie(String key) {
  String? cookies = html.document.cookie!;
  List<String> listValues = cookies.isNotEmpty ? cookies.split(";") : [];
  String matchVal = "";
  for (int i = 0; i < listValues.length; i++) {
    List<String> map = listValues[i].split("=");
    String _key = map[0].trim();
    String _val = map[1].trim();

    if (key == _key) {
      matchVal = _val;
      break;
    }
  }
  return matchVal;
}