toMap method

Map<String, dynamic> toMap({
  1. EnumMethod? enumMethod,
})

Converts instance to a map.

Implementation

Map<String, dynamic> toMap({EnumMethod? enumMethod}) {
  return {
    "domain": domain,
    "expiresDate": expiresDate,
    "isHttpOnly": isHttpOnly,
    "isSecure": isSecure,
    "isSessionOnly": isSessionOnly,
    "name": name,
    "path": path,
    "sameSite": switch (enumMethod ?? EnumMethod.nativeValue) {
      EnumMethod.nativeValue => sameSite?.toNativeValue(),
      EnumMethod.value => sameSite?.toValue(),
      EnumMethod.name => sameSite?.name(),
    },
    "value": value,
  };
}