getCookies method

Future<List<Cookie>> getCookies({
  1. List<String>? urls,
})

Returns all browser cookies for the current URL. Depending on the backend support, will return detailed cookie information in the cookies field. urls The list of URLs for which applicable cookies will be fetched. If not specified, it's assumed to be set to the list containing the URLs of the page and all of its subframes. Returns: Array of cookie objects.

Implementation

Future<List<Cookie>> getCookies({List<String>? urls}) async {
  var result = await _client.send('Network.getCookies', {
    if (urls != null) 'urls': [...urls],
  });
  return (result['cookies'] as List)
      .map((e) => Cookie.fromJson(e as Map<String, dynamic>))
      .toList();
}