The Cookie class has a Cookie.fromSetCookieValue constructor, that will naturally not work with a situation where the set-cookie header entry contains multiple cookies.
Suggestion
Add a static method List<Cookie> fromSetCookieValues(String value) to the Cookie that can be given a string containing multiple cookies, like this:
This repo does nothing with requests / cookies. Anyway, you can find a plenty of packages that do exactly what you are asking, for example - sweet_cookie_jar
Situation Some websites and API calls return multiple cookies at once, like this:
In the Dart
Response
object, they are grouped in a single map entry like this:The
Cookie
class has aCookie.fromSetCookieValue
constructor, that will naturally not work with a situation where theset-cookie
header entry contains multiple cookies.Suggestion Add a static method
List<Cookie> fromSetCookieValues(String value)
to theCookie
that can be given a string containing multiple cookies, like this:A practical example would then look like this:
That function could look somewhat like this: