diff --git a/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/MyCookieManager.java b/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/MyCookieManager.java index e35eb370..1a3e4266 100644 --- a/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/MyCookieManager.java +++ b/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/MyCookieManager.java @@ -45,7 +45,8 @@ public class MyCookieManager implements MethodChannel.MethodCallHandler { String value = (String) call.argument("value"); String domain = (String) call.argument("domain"); String path = (String) call.argument("path"); - Long expiresDate = new Long((String) call.argument("expiresDate")); + String expiresDateString = (String) call.argument("expiresDate"); + Long expiresDate = (expiresDateString != null ? new Long(expiresDateString) : null); Integer maxAge = (Integer) call.argument("maxAge"); Boolean isSecure = (Boolean) call.argument("isSecure"); MyCookieManager.setCookie(url, name, value, domain, path, expiresDate, maxAge, isSecure, result); diff --git a/lib/flutter_inappbrowser.dart b/lib/flutter_inappbrowser.dart index 06f1ebf2..53e59537 100644 --- a/lib/flutter_inappbrowser.dart +++ b/lib/flutter_inappbrowser.dart @@ -1393,7 +1393,7 @@ class CookieManager { args.putIfAbsent('value', () => value); args.putIfAbsent('domain', () => domain); args.putIfAbsent('path', () => path); - args.putIfAbsent('expiresDate', () => expiresDate.toString()); + args.putIfAbsent('expiresDate', () => expiresDate?.toString()); args.putIfAbsent('maxAge', () => maxAge); args.putIfAbsent('isSecure', () => isSecure);