From b4b38e1a762ad99a2adccee2461c10ad6777f24d Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Wed, 26 Feb 2025 19:28:08 -0800 Subject: [PATCH 1/6] Update to Dart/Flutter team lints and fix Three bits are a bit too tricky to fix now Removed a lot of dynamic invocations --- analysis_options.yaml | 24 ++++--------------- lib/src/async/web_driver.dart | 3 ++- lib/src/common/exception.dart | 4 ++-- lib/src/handler/infer_handler.dart | 3 ++- lib/src/handler/json_wire/element_finder.dart | 6 ++--- lib/src/handler/json_wire/mouse.dart | 2 +- lib/src/handler/json_wire/utils.dart | 6 ++--- lib/src/handler/json_wire/window.dart | 2 +- lib/src/handler/w3c/element.dart | 2 +- lib/src/handler/w3c/element_finder.dart | 6 ++--- lib/src/handler/w3c/session.dart | 2 +- lib/src/handler/w3c/utils.dart | 4 ++-- lib/src/handler/w3c/window.dart | 6 ++--- lib/src/sync/common.dart | 4 ++-- lib/src/sync/web_driver.dart | 7 ++++-- lib/src/sync/web_element.dart | 3 ++- lib/support/async.dart | 2 +- lib/support/firefox_profile.dart | 2 +- pubspec.yaml | 2 +- test/async_web_driver_test.dart | 6 +++-- test/async_window_test.dart | 2 +- test/configs/common_config.dart | 2 +- test/support/async_test.dart | 6 ++--- test/support/firefox_profile_test.dart | 14 +++++------ test/sync/web_driver.dart | 5 ++-- 25 files changed, 60 insertions(+), 65 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index f5964c4..e91d53d 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,13 +1,16 @@ # https://dart.dev/guides/language/analysis-options -include: package:lints/recommended.yaml +include: package:dart_flutter_team_lints/analysis_options.yaml analyzer: language: strict-casts: true + errors: + avoid_catching_errors: ignore + comment_references: ignore + only_throw_errors: ignore linter: rules: - - always_declare_return_types - avoid_bool_literals_in_conditional_expressions - avoid_classes_with_only_static_members - avoid_private_typedef_functions @@ -16,29 +19,12 @@ linter: - avoid_unused_constructor_parameters - avoid_void_async - cancel_subscriptions - - combinators_ordering - - directives_ordering - - lines_longer_than_80_chars - literal_only_boolean_expressions - missing_whitespace_between_adjacent_strings - no_adjacent_strings_in_list - - omit_local_variable_types - - prefer_asserts_in_initializer_lists - - prefer_const_constructors - prefer_const_declarations - prefer_expression_function_bodies - prefer_final_locals - - prefer_relative_imports - - prefer_single_quotes - - sort_pub_dependencies - - test_types_in_equals - - throw_in_finally - - type_annotate_public_apis - - unawaited_futures - - unnecessary_lambdas - - unnecessary_library_directive - - unnecessary_parenthesis - - unnecessary_statements - use_if_null_to_convert_nulls_to_bools - use_raw_strings - use_string_buffers diff --git a/lib/src/async/web_driver.dart b/lib/src/async/web_driver.dart index d71cfb6..b2dc54d 100644 --- a/lib/src/async/web_driver.dart +++ b/lib/src/async/web_driver.dart @@ -113,7 +113,8 @@ class WebDriver implements SearchContext { } /// Search for an element within the entire current page. - /// Throws [NoSuchElementException] if a matching element is not found. + /// Throws [sync_core.NoSuchElementException] if a matching element is not + /// found. @override Future findElement(By by) => _client.send( _handler.elementFinder.buildFindElementRequest(by), diff --git a/lib/src/common/exception.dart b/lib/src/common/exception.dart index fa5ec94..a4097bb 100644 --- a/lib/src/common/exception.dart +++ b/lib/src/common/exception.dart @@ -189,7 +189,7 @@ WebDriverException getExceptionFromJsonWireResponse( {int? httpStatusCode, String? httpReasonPhrase, dynamic jsonResp}) { if (jsonResp is Map) { final status = jsonResp['status'] as int?; - final message = jsonResp['value']['message'] as String?; + final message = (jsonResp['value'] as Map)['message'] as String?; switch (status) { case 0: @@ -258,7 +258,7 @@ WebDriverException getExceptionFromW3cResponse({ dynamic jsonResp, }) { if (jsonResp is Map && jsonResp.keys.contains('value')) { - final value = jsonResp['value']; + final value = jsonResp['value'] as Map; switch (value['error']) { case 'invalid argument': diff --git a/lib/src/handler/infer_handler.dart b/lib/src/handler/infer_handler.dart index 50533db..969d961 100644 --- a/lib/src/handler/infer_handler.dart +++ b/lib/src/handler/infer_handler.dart @@ -123,7 +123,8 @@ class InferSessionHandler extends SessionHandler { // May be W3C, as it will throw an unknown command exception. Map? body; try { - body = json.decode(response.body!)['value'] as Map?; + body = (json.decode(response.body!) as Map)['value'] + as Map?; } catch (e) { final rawBody = response.body?.isEmpty ?? true ? '' : response.body; diff --git a/lib/src/handler/json_wire/element_finder.dart b/lib/src/handler/json_wire/element_finder.dart index a1bf9e7..4fe5c81 100644 --- a/lib/src/handler/json_wire/element_finder.dart +++ b/lib/src/handler/json_wire/element_finder.dart @@ -17,9 +17,9 @@ class JsonWireElementFinder extends ElementFinder { @override List parseFindElementsResponse(WebDriverResponse response) => (parseJsonWireResponse(response) as List) - .map((e) => e[jsonWireElementStr]) - .toList() - .cast(); + .map((e) => (e as Map)[jsonWireElementStr]) + .cast() + .toList(); @override WebDriverRequest buildFindElementRequest(By by, [String? contextId]) { diff --git a/lib/src/handler/json_wire/mouse.dart b/lib/src/handler/json_wire/mouse.dart index ed0fe25..7dc00da 100644 --- a/lib/src/handler/json_wire/mouse.dart +++ b/lib/src/handler/json_wire/mouse.dart @@ -51,7 +51,7 @@ class JsonWireMouseHandler extends MouseHandler { 0, 'Move to an absolute location is only supported in W3C spec.'); } - final body = {}; + final body = {}; if (elementId != null) { body['element'] = elementId; } diff --git a/lib/src/handler/json_wire/utils.dart b/lib/src/handler/json_wire/utils.dart index 4537f52..7e0442e 100644 --- a/lib/src/handler/json_wire/utils.dart +++ b/lib/src/handler/json_wire/utils.dart @@ -29,7 +29,7 @@ Object? parseJsonWireResponse(WebDriverResponse response, statusCode > 299 || (responseBody['status'] != null && responseBody['status'] != 0)) { final status = responseBody['status'] as int?; - final message = responseBody['value']['message'] as String?; + final message = (responseBody['value'] as Map)['message'] as String?; switch (status) { case 0: @@ -108,9 +108,9 @@ Object? deserialize(Object? result, dynamic Function(String) createElement) { if (result.containsKey(jsonWireElementStr)) { return createElement(result[jsonWireElementStr] as String); } else { - final newResult = {}; + final newResult = {}; result.forEach((key, value) { - newResult[key] = deserialize(value, createElement); + newResult[key as String] = deserialize(value, createElement); }); return newResult; } diff --git a/lib/src/handler/json_wire/window.dart b/lib/src/handler/json_wire/window.dart index 05ef108..6bbc358 100644 --- a/lib/src/handler/json_wire/window.dart +++ b/lib/src/handler/json_wire/window.dart @@ -142,7 +142,7 @@ class JsonWireWindowHandler extends WindowHandler { WebDriverRequest.postRequest('execute', { 'script': 'return { width: window.innerWidth, height: window.innerHeight };', - 'args': [] + 'args': [] }); @override diff --git a/lib/src/handler/w3c/element.dart b/lib/src/handler/w3c/element.dart index 3366de9..8eb3385 100644 --- a/lib/src/handler/w3c/element.dart +++ b/lib/src/handler/w3c/element.dart @@ -81,7 +81,7 @@ class W3cElementHandler extends ElementHandler { WebDriverRequest.getRequest('${elementPrefix(elementId)}rect'); Rectangle _parseRectResponse(WebDriverResponse response) { - final rect = parseW3cResponse(response); + final rect = parseW3cResponse(response) as Map; return Rectangle( (rect['x'] as num).toInt(), (rect['y'] as num).toInt(), diff --git a/lib/src/handler/w3c/element_finder.dart b/lib/src/handler/w3c/element_finder.dart index e1d10c9..a52a921 100644 --- a/lib/src/handler/w3c/element_finder.dart +++ b/lib/src/handler/w3c/element_finder.dart @@ -47,7 +47,7 @@ class W3cElementFinder extends ElementFinder { @override List parseFindElementsResponse(WebDriverResponse response) => (parseW3cResponse(response) as List) - .map((e) => e[w3cElementStr] as String) + .map((e) => (e as Map)[w3cElementStr] as String) .toList(); @override @@ -58,7 +58,7 @@ class W3cElementFinder extends ElementFinder { @override String? parseFindActiveElementResponse(WebDriverResponse response) => - parseW3cResponse(response)[w3cElementStr] as String; + (parseW3cResponse(response) as Map)[w3cElementStr] as String; @override WebDriverRequest buildFindActiveElementRequest() => @@ -66,5 +66,5 @@ class W3cElementFinder extends ElementFinder { @override String? parseFindElementResponseCore(WebDriverResponse response) => - (parseW3cResponse(response) ?? {})[w3cElementStr] as String?; + (parseW3cResponse(response) as Map?)?[w3cElementStr] as String?; } diff --git a/lib/src/handler/w3c/session.dart b/lib/src/handler/w3c/session.dart index ba36d77..c1958a1 100644 --- a/lib/src/handler/w3c/session.dart +++ b/lib/src/handler/w3c/session.dart @@ -16,7 +16,7 @@ class W3cSessionHandler extends SessionHandler { @override SessionInfo parseCreateResponse(WebDriverResponse response) { - final session = parseW3cResponse(response); + final session = parseW3cResponse(response) as Map; return SessionInfo( session['sessionId'] as String, WebDriverSpec.W3c, diff --git a/lib/src/handler/w3c/utils.dart b/lib/src/handler/w3c/utils.dart index beac292..67bcc23 100644 --- a/lib/src/handler/w3c/utils.dart +++ b/lib/src/handler/w3c/utils.dart @@ -126,9 +126,9 @@ Object? deserialize(Object? result, dynamic Function(String) createElement) { if (result.containsKey(w3cElementStr)) { return createElement(result[w3cElementStr] as String); } else { - final newResult = {}; + final newResult = {}; result.forEach((key, value) { - newResult[key] = deserialize(value, createElement); + newResult[key as String] = deserialize(value, createElement); }); return newResult; } diff --git a/lib/src/handler/w3c/window.dart b/lib/src/handler/w3c/window.dart index f4802e6..2404dfc 100644 --- a/lib/src/handler/w3c/window.dart +++ b/lib/src/handler/w3c/window.dart @@ -66,7 +66,7 @@ class W3cWindowHandler extends WindowHandler { @override Rectangle parseRectResponse(WebDriverResponse response) { - final rect = parseW3cResponse(response); + final rect = parseW3cResponse(response) as Map; return Rectangle( (rect['x'] as num).toInt(), (rect['y'] as num).toInt(), @@ -143,12 +143,12 @@ class W3cWindowHandler extends WindowHandler { WebDriverRequest.postRequest('execute/sync', { 'script': 'return { width: window.innerWidth, height: window.innerHeight };', - 'args': [] + 'args': [] }); @override Rectangle parseInnerSizeResponse(WebDriverResponse response) { - final size = parseW3cResponse(response); + final size = parseW3cResponse(response) as Map; return Rectangle(0, 0, size['width'] as int, size['height'] as int); } } diff --git a/lib/src/sync/common.dart b/lib/src/sync/common.dart index fb3a0da..d53fb7d 100644 --- a/lib/src/sync/common.dart +++ b/lib/src/sync/common.dart @@ -14,7 +14,6 @@ import '../../async_core.dart' as async_core; import '../common/by.dart'; - import 'web_driver.dart'; import 'web_element.dart'; @@ -49,6 +48,7 @@ abstract class SearchContext { /// Searches for an element within the context. /// - /// Throws [NoSuchElementException] if no matching element is found. + /// Throws [async_core.NoSuchElementException] if no matching element is + /// found. WebElement findElement(By by); } diff --git a/lib/src/sync/web_driver.dart b/lib/src/sync/web_driver.dart index cffd807..8577b6a 100644 --- a/lib/src/sync/web_driver.dart +++ b/lib/src/sync/web_driver.dart @@ -117,7 +117,9 @@ class WebDriver implements SearchContext { } /// Search for an element within the entire current page. - /// Throws [NoSuchElementException] if a matching element is not found. + /// + /// Throws [async_core.NoSuchElementException] if a matching element is not + /// found. @override WebElement findElement(By by) => WebElement( this, @@ -129,7 +131,8 @@ class WebDriver implements SearchContext { by); /// Search for an element by xpath within the entire current page. - /// Throws [NoSuchElementException] if a matching element is not found. + /// Throws [async_core.NoSuchElementException] if a matching element is not + /// found. WebElement findElementByXpath(String by) => findElement(By.xpath(by)); /// An artist's rendition of the current page's source. diff --git a/lib/src/sync/web_element.dart b/lib/src/sync/web_element.dart index d28f57f..473cc2e 100644 --- a/lib/src/sync/web_element.dart +++ b/lib/src/sync/web_element.dart @@ -169,7 +169,8 @@ class WebElement extends common.WebElement implements SearchContext { ///Find an element nested within this element. /// - /// Throws [NoSuchElementException] if matching element is not found. + /// Throws [async_core.NoSuchElementException] if matching element is not + /// found. @override WebElement findElement(By by) => WebElement( driver, diff --git a/lib/support/async.dart b/lib/support/async.dart index 3427a2f..43f5758 100644 --- a/lib/support/async.dart +++ b/lib/support/async.dart @@ -78,7 +78,7 @@ class Clock { } void _matcherExpect(Object? value, m.Matcher matcher, String? reason) { - final matchState = {}; + final matchState = {}; if (matcher.matches(value, matchState)) { return; } diff --git a/lib/support/firefox_profile.dart b/lib/support/firefox_profile.dart index db655c6..5a022f7 100644 --- a/lib/support/firefox_profile.dart +++ b/lib/support/firefox_profile.dart @@ -199,7 +199,7 @@ class FirefoxProfile { var canNotParseCaption = true; for (final line in lines) { - final option = PrefsOption.parse(line); + final option = PrefsOption.parse(line); if (option is InvalidOption) { if (canNotParseCaption) { print('Can\'t parse lines from file "${file.path}":'); diff --git a/pubspec.yaml b/pubspec.yaml index f256e10..2968a1c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -17,5 +17,5 @@ dependencies: dev_dependencies: archive: ^4.0.2 - lints: ^4.0.0 + dart_flutter_team_lints: # ^5.0.0 test: ^1.24.0 diff --git a/test/async_web_driver_test.dart b/test/async_web_driver_test.dart index f5cfed2..dbec4c9 100644 --- a/test/async_web_driver_test.dart +++ b/test/async_web_driver_test.dart @@ -137,7 +137,8 @@ void main() { const script = ''' arguments[1].textContent = arguments[0]; return arguments[1];'''; - final e = await driver.execute(script, ['new text', button]); + final e = + await driver.execute(script, ['new text', button]) as WebElement; expect(await e.text, 'new text'); }); @@ -146,7 +147,8 @@ void main() { const script = ''' arguments[1].textContent = arguments[0]; arguments[2](arguments[1]);'''; - final e = await driver.executeAsync(script, ['new text', button]); + final e = await driver.executeAsync(script, ['new text', button]) + as WebElement; expect(await e.text, 'new text'); }); diff --git a/test/async_window_test.dart b/test/async_window_test.dart index 44a963b..a01d952 100644 --- a/test/async_window_test.dart +++ b/test/async_window_test.dart @@ -37,7 +37,7 @@ void main() { const size = Rectangle(0, 0, 600, 400); // Firefox may take a bit longer to do the resize. - await Future.delayed(const Duration(seconds: 1)); + await Future.delayed(const Duration(seconds: 1)); await window.setSize(size); expect(await window.size, size); }); diff --git a/test/configs/common_config.dart b/test/configs/common_config.dart index dd1778d..ce542ba 100644 --- a/test/configs/common_config.dart +++ b/test/configs/common_config.dart @@ -54,7 +54,7 @@ Map getCapabilities(WebDriverSpec spec) { final capabilities = Capabilities.chrome; final env = Platform.environment; - final chromeOptions = {}; + final chromeOptions = {}; if (env['CHROMEDRIVER_BINARY'] != null) { chromeOptions['binary'] = env['CHROMEDRIVER_BINARY']; diff --git a/test/support/async_test.dart b/test/support/async_test.dart index b9ae529..f4894b4 100644 --- a/test/support/async_test.dart +++ b/test/support/async_test.dart @@ -42,11 +42,11 @@ void main() { await lock.acquire(); unawaited(lock.acquire().then((_) => secondLockAcquired = true)); // Make sure that lock is not unacquired just because of timing - await Future.delayed(const Duration(seconds: 1)); + await Future.delayed(const Duration(seconds: 1)); expect(secondLockAcquired, isFalse); lock.release(); // Make sure that enough time has occurred that lock is acquired - await Future.delayed(const Duration(seconds: 1)); + await Future.delayed(const Duration(seconds: 1)); expect(secondLockAcquired, isTrue); }); @@ -149,7 +149,7 @@ void main() { Object? exception; try { - await clock.waitFor(() => Future.error('an exception')); + await clock.waitFor(() => Future.error('an exception')); } catch (e) { exception = e; } diff --git a/test/support/firefox_profile_test.dart b/test/support/firefox_profile_test.dart index 113ef1c..7174b64 100644 --- a/test/support/firefox_profile_test.dart +++ b/test/support/firefox_profile_test.dart @@ -32,7 +32,7 @@ void main() { r'7e08-4474-a285-3208198ce6fd}\":{\"d\":\"/opt/firefox/browser/' r'extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}\",\"e\":true,\' r'"v\":\"40.0\",\"st\":1439535413000,\"mt\":1438968709000}}}");'; - final option = PrefsOption.parse(value); + final option = PrefsOption.parse(value); expect(option, isA()); expect(option.asPrefString, value); }); @@ -40,21 +40,21 @@ void main() { test('parse and serialize string value with backslash', () { const value = 'user_pref("browser.cache.disk.parent_directory", ' r'"\\\\volume\\web\\cache\\mz");'; - final option = PrefsOption.parse(value); + final option = PrefsOption.parse(value); expect(option, isA()); expect(option.asPrefString, value); }); test('parse and serialize integer value', () { const value = 'user_pref("browser.cache.frecency_experiment", 3);'; - final option = PrefsOption.parse(value); + final option = PrefsOption.parse(value); expect(option, isA()); expect(option.asPrefString, value); }); test('parse and serialize negative integer value', () { const value = 'user_pref("browser.cache.frecency_experiment", -3);'; - final option = PrefsOption.parse(value); + final option = PrefsOption.parse(value); expect(option, isA()); expect(option.asPrefString, value); }); @@ -62,7 +62,7 @@ void main() { test('parse and serialize boolean true', () { const value = 'user_pref("browser.cache.disk.smart_size.first_run", true);'; - final option = PrefsOption.parse(value); + final option = PrefsOption.parse(value); expect(option, isA()); expect(option.asPrefString, value); }); @@ -70,7 +70,7 @@ void main() { test('parse and serialize boolean false', () { const value = 'user_pref("browser.cache.disk.smart_size.first_run", false);'; - final option = PrefsOption.parse(value); + final option = PrefsOption.parse(value); expect(option, isA()); expect(option.asPrefString, value); }); @@ -78,7 +78,7 @@ void main() { test('parse boolean uppercase True', () { const value = 'user_pref("browser.cache.disk.smart_size.first_run", True);'; - final option = PrefsOption.parse(value); + final option = PrefsOption.parse(value); expect(option, isA()); expect(option.value, true); }); diff --git a/test/sync/web_driver.dart b/test/sync/web_driver.dart index 77d04d0..369f405 100644 --- a/test/sync/web_driver.dart +++ b/test/sync/web_driver.dart @@ -139,7 +139,7 @@ void runTests({WebDriverSpec spec = WebDriverSpec.Auto}) { const script = ''' arguments[1].textContent = arguments[0]; return arguments[1];'''; - final e = driver.execute(script, ['new text', button]); + final e = driver.execute(script, ['new text', button]) as WebElement; expect(e.text, 'new text'); }); @@ -148,7 +148,8 @@ void runTests({WebDriverSpec spec = WebDriverSpec.Auto}) { const script = ''' arguments[1].textContent = arguments[0]; arguments[2](arguments[1]);'''; - final e = driver.executeAsync(script, ['new text', button]); + final e = + driver.executeAsync(script, ['new text', button]) as WebElement; expect(e.text, 'new text'); }); From f78b5711978ae2ecac7a29543e2790b4e075e27e Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Thu, 27 Feb 2025 10:55:14 -0800 Subject: [PATCH 2/6] Update pubspec.yaml Co-authored-by: Devon Carew --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 2968a1c..3ca947f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -17,5 +17,5 @@ dependencies: dev_dependencies: archive: ^4.0.2 - dart_flutter_team_lints: # ^5.0.0 + dart_flutter_team_lints: ^5.0.0 test: ^1.24.0 From fbc55566887206c9914b7bfb50958e5d28768ab3 Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Thu, 27 Feb 2025 11:00:44 -0800 Subject: [PATCH 3/6] review nit --- lib/src/handler/json_wire/mouse.dart | 2 +- lib/src/handler/json_wire/utils.dart | 2 +- lib/src/handler/w3c/utils.dart | 2 +- lib/src/handler/w3c/window.dart | 2 +- lib/support/async.dart | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/src/handler/json_wire/mouse.dart b/lib/src/handler/json_wire/mouse.dart index 7dc00da..7bbef5c 100644 --- a/lib/src/handler/json_wire/mouse.dart +++ b/lib/src/handler/json_wire/mouse.dart @@ -51,7 +51,7 @@ class JsonWireMouseHandler extends MouseHandler { 0, 'Move to an absolute location is only supported in W3C spec.'); } - final body = {}; + final body = {}; if (elementId != null) { body['element'] = elementId; } diff --git a/lib/src/handler/json_wire/utils.dart b/lib/src/handler/json_wire/utils.dart index 7e0442e..4d47967 100644 --- a/lib/src/handler/json_wire/utils.dart +++ b/lib/src/handler/json_wire/utils.dart @@ -108,7 +108,7 @@ Object? deserialize(Object? result, dynamic Function(String) createElement) { if (result.containsKey(jsonWireElementStr)) { return createElement(result[jsonWireElementStr] as String); } else { - final newResult = {}; + final newResult = {}; result.forEach((key, value) { newResult[key as String] = deserialize(value, createElement); }); diff --git a/lib/src/handler/w3c/utils.dart b/lib/src/handler/w3c/utils.dart index 67bcc23..91db0c1 100644 --- a/lib/src/handler/w3c/utils.dart +++ b/lib/src/handler/w3c/utils.dart @@ -126,7 +126,7 @@ Object? deserialize(Object? result, dynamic Function(String) createElement) { if (result.containsKey(w3cElementStr)) { return createElement(result[w3cElementStr] as String); } else { - final newResult = {}; + final newResult = {}; result.forEach((key, value) { newResult[key as String] = deserialize(value, createElement); }); diff --git a/lib/src/handler/w3c/window.dart b/lib/src/handler/w3c/window.dart index 2404dfc..262de2c 100644 --- a/lib/src/handler/w3c/window.dart +++ b/lib/src/handler/w3c/window.dart @@ -66,7 +66,7 @@ class W3cWindowHandler extends WindowHandler { @override Rectangle parseRectResponse(WebDriverResponse response) { - final rect = parseW3cResponse(response) as Map; + final rect = parseW3cResponse(response) as Map; return Rectangle( (rect['x'] as num).toInt(), (rect['y'] as num).toInt(), diff --git a/lib/support/async.dart b/lib/support/async.dart index 43f5758..52f79c1 100644 --- a/lib/support/async.dart +++ b/lib/support/async.dart @@ -78,7 +78,7 @@ class Clock { } void _matcherExpect(Object? value, m.Matcher matcher, String? reason) { - final matchState = {}; + final matchState = {}; if (matcher.matches(value, matchState)) { return; } From a2a0856eccad2756e6f10661528221d5e539277a Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Thu, 27 Feb 2025 11:01:19 -0800 Subject: [PATCH 4/6] review nit --- lib/src/common/exception.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/common/exception.dart b/lib/src/common/exception.dart index a4097bb..31ae937 100644 --- a/lib/src/common/exception.dart +++ b/lib/src/common/exception.dart @@ -258,7 +258,7 @@ WebDriverException getExceptionFromW3cResponse({ dynamic jsonResp, }) { if (jsonResp is Map && jsonResp.keys.contains('value')) { - final value = jsonResp['value'] as Map; + final value = jsonResp['value'] as Map; switch (value['error']) { case 'invalid argument': From 57e4c37339ed1d4cc465f19447808301fe4ecd7a Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Thu, 27 Feb 2025 11:02:21 -0800 Subject: [PATCH 5/6] review nit --- lib/src/handler/w3c/window.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/handler/w3c/window.dart b/lib/src/handler/w3c/window.dart index 262de2c..c2c40ec 100644 --- a/lib/src/handler/w3c/window.dart +++ b/lib/src/handler/w3c/window.dart @@ -148,7 +148,7 @@ class W3cWindowHandler extends WindowHandler { @override Rectangle parseInnerSizeResponse(WebDriverResponse response) { - final size = parseW3cResponse(response) as Map; + final size = parseW3cResponse(response) as Map; return Rectangle(0, 0, size['width'] as int, size['height'] as int); } } From d6ed950349beefdced7e18bcff665450ac929a78 Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Thu, 27 Feb 2025 11:03:40 -0800 Subject: [PATCH 6/6] oops --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 3ca947f..90be524 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -17,5 +17,5 @@ dependencies: dev_dependencies: archive: ^4.0.2 - dart_flutter_team_lints: ^5.0.0 + dart_flutter_team_lints: ^3.0.0 test: ^1.24.0