From abab589d802ce58ad787070072e077cb9f614af0 Mon Sep 17 00:00:00 2001 From: Lorenzo Pichilli Date: Sat, 8 Oct 2022 19:07:50 +0200 Subject: [PATCH] use flutter_lints as linter --- analysis_options.yaml | 2 +- example/analysis_options.yaml | 17 +---------------- .../custom_action_button.dart | 4 ++-- .../chrome_safari_browser/custom_menu_item.dart | 4 ++-- .../chrome_safari_browser/custom_tabs.dart | 2 +- .../chrome_safari_browser/main.dart | 2 +- .../chrome_safari_browser/open_and_close.dart | 2 +- .../trusted_web_activity.dart | 4 ++-- .../take_screenshot.dart | 1 - .../in_app_webview/audio_playback_policy.dart | 1 - .../in_app_webview/on_received_icon.dart | 1 - .../in_app_webview/post_requests.dart | 1 - .../in_app_webview/video_playback_policy.dart | 1 - example/pubspec.yaml | 2 +- .../chrome_safari_browser.dart | 1 - lib/src/in_app_browser/in_app_browser.dart | 1 - .../apple/in_app_webview_controller.dart | 1 - .../in_app_webview/headless_in_app_webview.dart | 3 --- lib/src/in_app_webview/in_app_webview.dart | 1 - .../in_app_webview_controller.dart | 3 --- .../in_app_webview/in_app_webview_settings.dart | 3 --- .../pull_to_refresh_controller.dart | 1 - lib/src/types/ajax_request_event_type.dart | 1 + lib/src/types/modal_transition_style.dart | 1 + lib/src/types/web_history.dart | 2 -- .../headless_in_app_web_view_web_element.dart | 1 - lib/src/web/in_app_web_view_web_element.dart | 2 -- pubspec.yaml | 2 +- 28 files changed, 15 insertions(+), 52 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index fb01cf49..24ec4a21 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,4 +1,4 @@ -include: package:lints/recommended.yaml +include: package:flutter_lints/flutter.yaml linter: rules: diff --git a/example/analysis_options.yaml b/example/analysis_options.yaml index 61b6c4de..61b84110 100644 --- a/example/analysis_options.yaml +++ b/example/analysis_options.yaml @@ -10,20 +10,5 @@ include: package:flutter_lints/flutter.yaml linter: - # The lint rules applied to this project can be customized in the - # section below to disable rules from the `package:flutter_lints/flutter.yaml` - # included above or to enable additional rules. A list of all available lints - # and their documentation is published at - # https://dart-lang.github.io/linter/lints/index.html. - # - # Instead of disabling a lint rule for the entire project in the - # section below, it can also be suppressed for a single line of code - # or a specific dart file by using the `// ignore: name_of_lint` and - # `// ignore_for_file: name_of_lint` syntax on the line or in the file - # producing the lint. rules: - # avoid_print: false # Uncomment to disable the `avoid_print` rule - # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule - -# Additional information about this file can be found at -# https://dart.dev/guides/language/analysis-options + constant_identifier_names: ignore \ No newline at end of file diff --git a/example/integration_test/chrome_safari_browser/custom_action_button.dart b/example/integration_test/chrome_safari_browser/custom_action_button.dart index 2ace899d..6744eb85 100644 --- a/example/integration_test/chrome_safari_browser/custom_action_button.dart +++ b/example/integration_test/chrome_safari_browser/custom_action_button.dart @@ -14,7 +14,7 @@ void customActionButton() { ].contains(defaultTargetPlatform); test('add custom action button', () async { - var chromeSafariBrowser = new MyChromeSafariBrowser(); + var chromeSafariBrowser = MyChromeSafariBrowser(); var actionButtonIcon = await rootBundle.load('test_assets/images/flutter-logo.png'); chromeSafariBrowser.setActionButton(ChromeSafariBrowserActionButton( @@ -22,7 +22,7 @@ void customActionButton() { description: 'Action Button description', icon: actionButtonIcon.buffer.asUint8List(), action: (url, title) { - print('Action Button 1 clicked!'); + })); expect(chromeSafariBrowser.isOpened(), false); diff --git a/example/integration_test/chrome_safari_browser/custom_menu_item.dart b/example/integration_test/chrome_safari_browser/custom_menu_item.dart index 8fefd202..ef8d72a3 100644 --- a/example/integration_test/chrome_safari_browser/custom_menu_item.dart +++ b/example/integration_test/chrome_safari_browser/custom_menu_item.dart @@ -15,12 +15,12 @@ void customMenuItem() { ].contains(defaultTargetPlatform); test('add custom menu item', () async { - var chromeSafariBrowser = new MyChromeSafariBrowser(); + var chromeSafariBrowser = MyChromeSafariBrowser(); chromeSafariBrowser.addMenuItem(ChromeSafariBrowserMenuItem( id: 2, label: 'Custom item menu 1', action: (url, title) { - print('Custom item menu 1 clicked!'); + })); expect(chromeSafariBrowser.isOpened(), false); diff --git a/example/integration_test/chrome_safari_browser/custom_tabs.dart b/example/integration_test/chrome_safari_browser/custom_tabs.dart index c658e621..fbfe5496 100644 --- a/example/integration_test/chrome_safari_browser/custom_tabs.dart +++ b/example/integration_test/chrome_safari_browser/custom_tabs.dart @@ -14,7 +14,7 @@ void customTabs() { group('Custom Tabs', () { test('single instance', () async { - var chromeSafariBrowser = new MyChromeSafariBrowser(); + var chromeSafariBrowser = MyChromeSafariBrowser(); expect(chromeSafariBrowser.isOpened(), false); await chromeSafariBrowser.open( diff --git a/example/integration_test/chrome_safari_browser/main.dart b/example/integration_test/chrome_safari_browser/main.dart index 490f8257..85dde745 100644 --- a/example/integration_test/chrome_safari_browser/main.dart +++ b/example/integration_test/chrome_safari_browser/main.dart @@ -8,7 +8,7 @@ import 'open_and_close.dart'; import 'trusted_web_activity.dart'; void main() { - final shouldSkip = kIsWeb; + const shouldSkip = kIsWeb; group('ChromeSafariBrowser', () { openAndClose(); diff --git a/example/integration_test/chrome_safari_browser/open_and_close.dart b/example/integration_test/chrome_safari_browser/open_and_close.dart index decfe600..6f4dba52 100644 --- a/example/integration_test/chrome_safari_browser/open_and_close.dart +++ b/example/integration_test/chrome_safari_browser/open_and_close.dart @@ -15,7 +15,7 @@ void openAndClose() { ].contains(defaultTargetPlatform); test('open and close', () async { - var chromeSafariBrowser = new MyChromeSafariBrowser(); + var chromeSafariBrowser = MyChromeSafariBrowser(); expect(chromeSafariBrowser.isOpened(), false); await chromeSafariBrowser.open(url: TEST_URL_1); diff --git a/example/integration_test/chrome_safari_browser/trusted_web_activity.dart b/example/integration_test/chrome_safari_browser/trusted_web_activity.dart index 35eee478..99b23b27 100644 --- a/example/integration_test/chrome_safari_browser/trusted_web_activity.dart +++ b/example/integration_test/chrome_safari_browser/trusted_web_activity.dart @@ -14,7 +14,7 @@ void trustedWebActivity() { group('Trusted Web Activity', () { test('basic', () async { - var chromeSafariBrowser = new MyChromeSafariBrowser(); + var chromeSafariBrowser = MyChromeSafariBrowser(); expect(chromeSafariBrowser.isOpened(), false); await chromeSafariBrowser.open( @@ -33,7 +33,7 @@ void trustedWebActivity() { }); test('single instance', () async { - var chromeSafariBrowser = new MyChromeSafariBrowser(); + var chromeSafariBrowser = MyChromeSafariBrowser(); expect(chromeSafariBrowser.isOpened(), false); await chromeSafariBrowser.open( diff --git a/example/integration_test/headless_in_app_webview/take_screenshot.dart b/example/integration_test/headless_in_app_webview/take_screenshot.dart index 8c25cc41..3164c24b 100644 --- a/example/integration_test/headless_in_app_webview/take_screenshot.dart +++ b/example/integration_test/headless_in_app_webview/take_screenshot.dart @@ -1,5 +1,4 @@ import 'dart:async'; -import 'dart:typed_data'; import 'package:flutter/foundation.dart'; import 'package:flutter/widgets.dart'; diff --git a/example/integration_test/in_app_webview/audio_playback_policy.dart b/example/integration_test/in_app_webview/audio_playback_policy.dart index 6d4d2d5b..89b6b46c 100644 --- a/example/integration_test/in_app_webview/audio_playback_policy.dart +++ b/example/integration_test/in_app_webview/audio_playback_policy.dart @@ -1,6 +1,5 @@ import 'dart:async'; import 'dart:convert'; -import 'dart:typed_data'; import 'package:flutter/foundation.dart'; import 'package:flutter/services.dart'; diff --git a/example/integration_test/in_app_webview/on_received_icon.dart b/example/integration_test/in_app_webview/on_received_icon.dart index 7c304158..109851ac 100644 --- a/example/integration_test/in_app_webview/on_received_icon.dart +++ b/example/integration_test/in_app_webview/on_received_icon.dart @@ -1,5 +1,4 @@ import 'dart:async'; -import 'dart:typed_data'; import 'package:flutter/foundation.dart'; import 'package:flutter/widgets.dart'; diff --git a/example/integration_test/in_app_webview/post_requests.dart b/example/integration_test/in_app_webview/post_requests.dart index a866ac2f..e5fc931d 100644 --- a/example/integration_test/in_app_webview/post_requests.dart +++ b/example/integration_test/in_app_webview/post_requests.dart @@ -1,6 +1,5 @@ import 'dart:async'; import 'dart:convert'; -import 'dart:typed_data'; import 'package:flutter/foundation.dart'; import 'package:flutter/widgets.dart'; diff --git a/example/integration_test/in_app_webview/video_playback_policy.dart b/example/integration_test/in_app_webview/video_playback_policy.dart index cbae5f65..1d27db34 100644 --- a/example/integration_test/in_app_webview/video_playback_policy.dart +++ b/example/integration_test/in_app_webview/video_playback_policy.dart @@ -1,6 +1,5 @@ import 'dart:async'; import 'dart:convert'; -import 'dart:typed_data'; import 'package:flutter/foundation.dart'; import 'package:flutter/services.dart'; diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 9e1b803e..55579f4b 100755 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -42,7 +42,7 @@ dev_dependencies: # git: # url: https://github.com/flutter/plugins.git # path: packages/integration_test - pedantic: ^1.8.0 + flutter_lints: ^2.0.1 # For information on the generic Dart part of this file, see the # following page: https://www.dartlang.org/tools/pub/pubspec diff --git a/lib/src/chrome_safari_browser/chrome_safari_browser.dart b/lib/src/chrome_safari_browser/chrome_safari_browser.dart index 75afc38d..d02a7e22 100755 --- a/lib/src/chrome_safari_browser/chrome_safari_browser.dart +++ b/lib/src/chrome_safari_browser/chrome_safari_browser.dart @@ -1,6 +1,5 @@ import 'dart:async'; import 'dart:collection'; -import 'dart:typed_data'; import 'dart:developer' as developer; import 'package:flutter/foundation.dart'; diff --git a/lib/src/in_app_browser/in_app_browser.dart b/lib/src/in_app_browser/in_app_browser.dart index 9ed69288..828537b9 100755 --- a/lib/src/in_app_browser/in_app_browser.dart +++ b/lib/src/in_app_browser/in_app_browser.dart @@ -1,6 +1,5 @@ import 'dart:async'; import 'dart:collection'; -import 'dart:typed_data'; import 'dart:developer' as developer; import 'package:flutter/services.dart'; diff --git a/lib/src/in_app_webview/apple/in_app_webview_controller.dart b/lib/src/in_app_webview/apple/in_app_webview_controller.dart index e4949738..4d13b9d8 100644 --- a/lib/src/in_app_webview/apple/in_app_webview_controller.dart +++ b/lib/src/in_app_webview/apple/in_app_webview_controller.dart @@ -1,5 +1,4 @@ import 'dart:core'; -import 'dart:typed_data'; import 'package:flutter/services.dart'; diff --git a/lib/src/in_app_webview/headless_in_app_webview.dart b/lib/src/in_app_webview/headless_in_app_webview.dart index bf9b7249..3883316d 100644 --- a/lib/src/in_app_webview/headless_in_app_webview.dart +++ b/lib/src/in_app_webview/headless_in_app_webview.dart @@ -1,6 +1,4 @@ import 'dart:collection'; -import 'dart:typed_data'; -import 'dart:ui'; import 'package:flutter/services.dart'; import 'package:flutter_inappwebview/src/util.dart'; @@ -14,7 +12,6 @@ import 'in_app_webview_controller.dart'; import 'in_app_webview_settings.dart'; import '../pull_to_refresh/pull_to_refresh_controller.dart'; import '../pull_to_refresh/pull_to_refresh_settings.dart'; -import '../util.dart'; import '../types/disposable.dart'; ///Class that represents a WebView in headless mode. diff --git a/lib/src/in_app_webview/in_app_webview.dart b/lib/src/in_app_webview/in_app_webview.dart index 4b2acb41..056394ac 100755 --- a/lib/src/in_app_webview/in_app_webview.dart +++ b/lib/src/in_app_webview/in_app_webview.dart @@ -1,6 +1,5 @@ import 'dart:async'; import 'dart:collection'; -import 'dart:typed_data'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; diff --git a/lib/src/in_app_webview/in_app_webview_controller.dart b/lib/src/in_app_webview/in_app_webview_controller.dart index b649f8e5..9fac0e56 100644 --- a/lib/src/in_app_webview/in_app_webview_controller.dart +++ b/lib/src/in_app_webview/in_app_webview_controller.dart @@ -1,14 +1,11 @@ import 'dart:io'; import 'dart:collection'; -import 'dart:typed_data'; import 'dart:convert'; import 'dart:core'; import 'dart:developer' as developer; import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter/widgets.dart'; import 'android/in_app_webview_controller.dart'; import 'apple/in_app_webview_controller.dart'; diff --git a/lib/src/in_app_webview/in_app_webview_settings.dart b/lib/src/in_app_webview/in_app_webview_settings.dart index 02a71670..aaa6a861 100755 --- a/lib/src/in_app_webview/in_app_webview_settings.dart +++ b/lib/src/in_app_webview/in_app_webview_settings.dart @@ -1,9 +1,6 @@ -import 'dart:ui'; - import 'package:flutter/foundation.dart'; import 'package:flutter/widgets.dart'; -import '../types/requested_with_header_mode.dart'; import 'android/in_app_webview_options.dart'; import 'apple/in_app_webview_options.dart'; import '../content_blocker.dart'; diff --git a/lib/src/pull_to_refresh/pull_to_refresh_controller.dart b/lib/src/pull_to_refresh/pull_to_refresh_controller.dart index 30012b70..ac475122 100644 --- a/lib/src/pull_to_refresh/pull_to_refresh_controller.dart +++ b/lib/src/pull_to_refresh/pull_to_refresh_controller.dart @@ -1,4 +1,3 @@ -import 'dart:ui'; import 'dart:developer' as developer; import 'package:flutter/services.dart'; diff --git a/lib/src/types/ajax_request_event_type.dart b/lib/src/types/ajax_request_event_type.dart index a6ccb1c5..a56be081 100644 --- a/lib/src/types/ajax_request_event_type.dart +++ b/lib/src/types/ajax_request_event_type.dart @@ -7,6 +7,7 @@ part 'ajax_request_event_type.g.dart'; ///Class used by [AjaxRequestEvent] class. @ExchangeableEnum() class AjaxRequestEventType_ { + // ignore: unused_field final String _value; const AjaxRequestEventType_._internal(this._value); diff --git a/lib/src/types/modal_transition_style.dart b/lib/src/types/modal_transition_style.dart index c47736c0..9f2c669a 100644 --- a/lib/src/types/modal_transition_style.dart +++ b/lib/src/types/modal_transition_style.dart @@ -33,6 +33,7 @@ class ModalTransitionStyle_ { @Deprecated("Use ModalTransitionStyle instead") @ExchangeableEnum() class IOSUIModalTransitionStyle_ { + // ignore: unused_field final int _value; const IOSUIModalTransitionStyle_._internal(this._value); diff --git a/lib/src/types/web_history.dart b/lib/src/types/web_history.dart index 82e0c90f..fde131bb 100644 --- a/lib/src/types/web_history.dart +++ b/lib/src/types/web_history.dart @@ -1,5 +1,3 @@ -import 'dart:collection'; - import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart'; import '../in_app_webview/webview.dart'; diff --git a/lib/src/web/headless_in_app_web_view_web_element.dart b/lib/src/web/headless_in_app_web_view_web_element.dart index 44bb8c26..dd1c9757 100644 --- a/lib/src/web/headless_in_app_web_view_web_element.dart +++ b/lib/src/web/headless_in_app_web_view_web_element.dart @@ -1,6 +1,5 @@ import 'dart:async'; import 'package:flutter/services.dart'; -import 'package:flutter/widgets.dart'; import 'in_app_web_view_web_element.dart'; import '../util.dart'; diff --git a/lib/src/web/in_app_web_view_web_element.dart b/lib/src/web/in_app_web_view_web_element.dart index 3bcc5758..98e5f3f9 100644 --- a/lib/src/web/in_app_web_view_web_element.dart +++ b/lib/src/web/in_app_web_view_web_element.dart @@ -1,6 +1,4 @@ import 'dart:async'; -import 'dart:typed_data'; -import 'dart:ui'; import 'package:flutter/services.dart'; import 'dart:html'; import 'dart:js' as js; diff --git a/pubspec.yaml b/pubspec.yaml index 83bf46df..0773155c 100755 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -20,7 +20,7 @@ dev_dependencies: sdk: flutter flutter_driver: sdk: flutter - lints: ^1.0.1 + flutter_lints: ^2.0.1 build_runner: ^2.2.1 generators: path: dev_packages/generators