createCookie method
Create a cookie from the session.
Implementation
Future<Cookie> createCookie(Session session) async {
final cookie = Cookie(name, session.identifier)
..domain = domain
..path = path
..secure = secure
..httpOnly = httpOnly;
final DateTime? expiresAt = await adapter.expiresAt(session.identifier);
if (expiresAt != null) {
cookie.expires = expiresAt;
cookie.maxAge = expiresAt.difference(DateTime.now()).inSeconds;
}
return cookie;
}