Cookie.fromJson constructor

Cookie.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory Cookie.fromJson(Map<String, dynamic> json) {
  return Cookie(
    name: json['name'] as String,
    value: json['value'] as String,
    domain: json['domain'] as String,
    path: json['path'] as String,
    expires: json['expires'] as num,
    size: json['size'] as int,
    httpOnly: json['httpOnly'] as bool? ?? false,
    secure: json['secure'] as bool? ?? false,
    session: json['session'] as bool? ?? false,
    sameSite: json.containsKey('sameSite')
        ? CookieSameSite.fromJson(json['sameSite'] as String)
        : null,
    priority: CookiePriority.fromJson(json['priority'] as String),
    sourceScheme: CookieSourceScheme.fromJson(json['sourceScheme'] as String),
    sourcePort: json['sourcePort'] as int,
    partitionKey: json.containsKey('partitionKey')
        ? CookiePartitionKey.fromJson(
            json['partitionKey'] as Map<String, dynamic>)
        : null,
    partitionKeyOpaque: json.containsKey('partitionKeyOpaque')
        ? json['partitionKeyOpaque'] as bool
        : null,
  );
}