From 32645998222d56f883450f596783c9281c57ec24 Mon Sep 17 00:00:00 2001 From: Daisuke Ueta Date: Mon, 25 Dec 2023 18:11:09 +0900 Subject: [PATCH 1/2] Added == operator to WebUri --- .../lib/src/web_uri.dart | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/flutter_inappwebview_platform_interface/lib/src/web_uri.dart b/flutter_inappwebview_platform_interface/lib/src/web_uri.dart index 4abe5c8a..90899acf 100644 --- a/flutter_inappwebview_platform_interface/lib/src/web_uri.dart +++ b/flutter_inappwebview_platform_interface/lib/src/web_uri.dart @@ -188,6 +188,17 @@ class WebUri implements Uri { @override String get userInfo => _uri.userInfo; + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + return other is WebUri && + _uri == other._uri && + _rawValue == other._rawValue && + forceToStringRawValue == other.forceToStringRawValue; + } + ///If [forceToStringRawValue] is `true` or [isValidUri] is `false`, it returns [rawValue], ///otherwise the value of [uriValue]`.toString()`. @override From e000cd8a4cdb94c5db283811c7e4325b81e6030a Mon Sep 17 00:00:00 2001 From: Lorenzo Pichilli Date: Mon, 25 Dec 2023 18:04:24 +0100 Subject: [PATCH 2/2] Update web_uri.dart updated WebUri operator == and hashCode with the generated version --- .../lib/src/web_uri.dart | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/flutter_inappwebview_platform_interface/lib/src/web_uri.dart b/flutter_inappwebview_platform_interface/lib/src/web_uri.dart index 90899acf..23968ece 100644 --- a/flutter_inappwebview_platform_interface/lib/src/web_uri.dart +++ b/flutter_inappwebview_platform_interface/lib/src/web_uri.dart @@ -189,15 +189,21 @@ class WebUri implements Uri { String get userInfo => _uri.userInfo; @override - bool operator ==(Object other) { - if (identical(this, other)) { - return true; - } - return other is WebUri && - _uri == other._uri && - _rawValue == other._rawValue && - forceToStringRawValue == other.forceToStringRawValue; - } + bool operator ==(Object other) => + identical(this, other) || + other is WebUri && + runtimeType == other.runtimeType && + _uri == other._uri && + _rawValue == other._rawValue && + _isValidUri == other._isValidUri && + forceToStringRawValue == other.forceToStringRawValue; + + @override + int get hashCode => + _uri.hashCode ^ + _rawValue.hashCode ^ + _isValidUri.hashCode ^ + forceToStringRawValue.hashCode; ///If [forceToStringRawValue] is `true` or [isValidUri] is `false`, it returns [rawValue], ///otherwise the value of [uriValue]`.toString()`.