setCookie method

Future<void> setCookie(
  1. {required String url,
  2. required String name,
  3. required String value,
  4. String? domain,
  5. String path = "/",
  6. Duration? maxAge,
  7. bool? isSecure}
)

Implementation

Future<void> setCookie({
  required String url,
  required String name,
  required String value,
  String? domain,
  String path = "/",
  Duration? maxAge,
  bool? isSecure,
}) async {
  assert(url.isNotEmpty);
  assert(name.isNotEmpty);
  assert(value.isNotEmpty);
  assert(path.isNotEmpty);

  var args = <String, dynamic>{
    "url": url,
    "name": name,
    "value": value,
    "domain": domain,
    "path": path,
    "maxAge": maxAge?.inSeconds != null && maxAge!.inSeconds > 0
        ? maxAge.inSeconds.toString()
        : null,
    "isSecure": isSecure,
  };
  await _channel.invokeMethod('setCookie', args);
}