findMaxAgeAttr method
Implementation
DateTime? findMaxAgeAttr(String setCookie, int startIndex, DateTime now) {
final ai = setCookie.indexOf("Max-Age=", startIndex);
if (ai == -1) {
return null;
}
final i = ai + 8;
final j = setCookie.indexOf(';', i);
final maxAgeStr = j == -1 ? setCookie.substring(i) : setCookie.substring(i, j);
final maxAge = int.parse(maxAgeStr);
return now.add(Duration(seconds: maxAge));
}