Skip to content

After upgrading to Flutter 3.7.6 flutter analyze is throwing an error about "Multiple plugins can't be enabled" #121836

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 tasks done
cfsbhawkins opened this issue Mar 2, 2023 · 11 comments
Labels
r: solved Issue is closed as solved

Comments

@cfsbhawkins
Copy link

Is there an existing issue for this?

Steps to reproduce

I have a flutter analysis setup in my project, it has a few plugins it loads. After upgrading flutter to 3.7.6 from 3.7.5 nothing seems to run because it throws an warning about "Multiple plugins can't be enabled" when you open dart analysis in android studio. Reverting my change in pubspec and doing a flutter downgrade back to 3.7.5 fixes the issue.

Was a breaking change introduced in 3.7.6?

`analyzer:
exclude:
- "plugins/components/lib/l10n/"
- "plugins/map/lib/l10n/
"
- "plugins/repository/lib/l10n/"
- "lib/generated/
"
- "ios/"
- "
/.graphql.dart"
- "**/
.g.dart"
- "**/*.freezed.dart"
plugins:
- dart_code_metrics
- string_literal_finder
strong-mode:
implicit-casts: false
implicit-dynamic: true
errors:
close_sinks: ignore
missing_return: error
missing_required_param: error
unrelated_type_equality_checks: error
deprecated_member_use_from_same_package: ignore
invalid_use_of_visible_for_testing_member: error
invalid_use_of_protected_member: error
import_of_legacy_library_into_null_safe: ignore

string_literal_finder:
exclude_globs:
- "/*.graphql.dart"
- "
/.g.dart"
- "**/
.freezed.dart"

dart_code_metrics:
anti-patterns:
- long-method
metrics:
cyclomatic-complexity: 20
maximum-nesting: 5
rules:
- newline-before-return
- no-equal-then-else
- member-ordering:
order:
- public_fields
- private_fields
- constructors

linter:
rules:
- annotate_overrides
- avoid_empty_else
- avoid_init_to_null
- avoid_null_checks_in_equality_operators
- avoid_print
- avoid_relative_lib_imports
- avoid_renaming_method_parameters
- avoid_return_types_on_setters
- avoid_returning_null
- avoid_types_as_parameter_names
- avoid_unused_constructor_parameters
- avoid_void_async
- await_only_futures
- camel_case_types
- cancel_subscriptions
- cascade_invocations
- comment_references
- constant_identifier_names
- control_flow_in_finally
- directives_ordering
- empty_catches
- empty_constructor_bodies
- empty_statements
- hash_and_equals
- implementation_imports
- iterable_contains_unrelated_type
- library_names
- library_prefixes
- list_remove_unrelated_type
- no_adjacent_strings_in_list
- no_duplicate_case_values
- non_constant_identifier_names
- null_closures
- only_throw_errors
- package_api_docs
- package_names
- package_prefixed_library_names
- prefer_adjacent_string_concatenation
- prefer_collection_literals
- prefer_conditional_assignment
- prefer_contains
- prefer_equal_for_default_values
- prefer_final_fields
- prefer_initializing_formals
- prefer_interpolation_to_compose_strings
- prefer_is_empty
- prefer_is_not_empty
- prefer_single_quotes
- prefer_typing_uninitialized_variables
- recursive_getters
- slash_for_doc_comments
- test_types_in_equals
- throw_in_finally
- type_init_formals
- unawaited_futures
- unnecessary_await_in_return
- unnecessary_brace_in_string_interps
- unnecessary_const
- unnecessary_getters_setters
- unnecessary_lambdas
- unnecessary_new
- unnecessary_null_aware_assignments
- unnecessary_statements
- unnecessary_this
- unrelated_type_equality_checks
- use_rethrow_when_possible
- valid_regexps
`

Actual results

In 3.7.5:
Screenshot 2023-03-02 at 4 46 22 PM

Warning in 3.7.6:
Screenshot 2023-03-02 at 4 35 43 PM

Logs

No response

Flutter Doctor output

Flutter doctor on 3.7.5:

`[✓] Flutter (Channel stable, 3.7.5, on macOS 13.2.1 22D68 darwin-x64, locale en-US)
• Flutter version 3.7.5 on channel stable at /Users/XXX/FlutterSDK/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision c07f788 (8 days ago), 2023-02-22 17:52:33 -0600
• Engine revision 0f359063c4
• Dart version 2.19.2
• DevTools version 2.20.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at /Users/XXX/Library/Android/sdk
• Platform android-33, build-tools 33.0.0
• Java binary at: /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9 (build 11.0.11+9)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14C18
• CocoaPods version 1.11.3

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[!] Android Studio (version 2022.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
✗ Unable to find bundled Java version.
• Try updating or re-installing Android Studio.

[✓] VS Code (version 1.75.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.58.0

[✓] Connected device (2 available)
• macOS (desktop) • macos • darwin-x64 • macOS 13.2.1 22D68 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 110.0.5481.177

[✓] HTTP Host Availability
• All required HTTP hosts are available

! Doctor found issues in 1 category.
`

Flutter doctor on 3.7.6:

`[✓] Flutter (Channel stable, 3.7.6, on macOS 13.2.1 22D68 darwin-x64, locale en-US)
• Flutter version 3.7.6 on channel stable at /Users/XXX/FlutterSDK/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 12cb4eb (28 hours ago), 2023-03-01 10:29:26 -0800
• Engine revision ada363ee93
• Dart version 2.19.3
• DevTools version 2.20.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at /Users/XXX/Library/Android/sdk
• Platform android-33, build-tools 33.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14C18
• CocoaPods version 1.11.3

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)

[✓] VS Code (version 1.75.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.58.0

[✓] Connected device (2 available)
• macOS (desktop) • macos • darwin-x64 • macOS 13.2.1 22D68 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 110.0.5481.177

[✓] HTTP Host Availability
• All required HTTP hosts are available

• No issues found!
`

@darshankawar darshankawar added the in triage Presently being triaged by the triage team label Mar 3, 2023
@darshankawar
Copy link
Member

Thanks for the report @cfsbhawkins
I tried the scenario you mentioned in a sample app which has quite a few plugins and ran flutter analyze using stable 3.7.5 and 3.7.6, but didn't see the log as you mentioned.

console log

dhs@Dhss-MacBook-Pro test_app % flutter analyze    
Analyzing test_app...                                                   

warning • The include file 'package:flutter_lints/flutter.yaml' in '/Users/dhs/Documents/NCFlutter/test_app/analysis_options.yaml' can't be found when analyzing
       '/Users/dhs/Documents/NCFlutter/test_app' • analysis_options.yaml:10:10 • include_file_not_found
  error • Target of URI doesn't exist: 'package:integration_test/integration_test.dart' • integration_test/app_test.dart:3:8 • uri_does_not_exist
  error • Undefined name 'IntegrationTestWidgetsFlutterBinding' • integration_test/app_test.dart:9:3 • undefined_identifier
  error • 2 positional arguments expected by 'Offset.new', but 0 found • lib/main.dart:78:26 • not_enough_positional_arguments
   info • The declaration '_handleOnPointerDown' isn't referenced • lib/main.dart:84:8 • unused_element
   info • The declaration '_handleOnPointerUp' isn't referenced • lib/main.dart:95:8 • unused_element
   info • The declaration '_buildAnimation' isn't referenced • lib/main.dart:102:10 • unused_element
   info • The import of 'package:flutter/widgets.dart' is unnecessary because all of the used elements are also provided by the import of 'package:flutter/material.dart' •
          lib/my_widget_test.dart:5:8 • unnecessary_import
  error • Target of URI doesn't exist: 'package:integration_test/integration_test_driver.dart' • test_driver/integration_test.dart:1:8 • uri_does_not_exist
  error • The function 'integrationDriver' isn't defined • test_driver/integration_test.dart:3:24 • undefined_function

10 issues found. (ran in 2.4s)
dhs@Dhss-MacBook-Pro test_app % 


Was a breaking change introduced in 3.7.6?

See https://github.com/flutter/flutter/wiki/Hotfixes-to-the-Stable-Channel#376-mar-01-2023 for fixes pushed in 3.7.6 . I am not sure if dart-lang/sdk#50981 could be related for the behavior you are seeing.

Are there any specific steps to replicate that you can share that triggers the error by the analyzer ?

@darshankawar darshankawar added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Mar 3, 2023
@Maatteogekko
Copy link

I am also experiencing this "issue". This is my analysis yaml:

include: package:lint/analysis_options.yaml

analyzer:
  errors:
    ...
  exclude:
    ...
  plugins:
    - dart_code_metrics
    - custom_lint

...

I get the warning on the line with custom_lint. Does dart-lang/sdk#50981 mean that we can no longer use multiple plugins? Or is it just discouraged?

@cfsbhawkins
Copy link
Author

It does look like that change is what is causing it. We run the two plugins to verify code quality, but as well as making sure we did not have hard coded strings at pull request time. I guess to upgrade to newer flutter versions we will need to decide what we care most about, or hope that dart_code_metrics or something picks up string literals.

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Mar 3, 2023
@cfsbhawkins
Copy link
Author

It does not appear to me that it runs that second plugin, as we had some string literals get into the code.

@darshankawar
Copy link
Member

@cfsbhawkins
Does this mean you now know why is it throwing an error and it is expected ? or you think this needs to be addressed ?

@darshankawar darshankawar added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Mar 6, 2023
@cfsbhawkins
Copy link
Author

Yes. I understand why its throwing the error. I guess if this is the way it is now, we will have to find other linter plugins that can do all the checks we need.

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Mar 6, 2023
@darshankawar
Copy link
Member

Thanks for the update. Is it safe to close this issue as resolved ?

@darshankawar darshankawar added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Mar 7, 2023
@darshankawar darshankawar added r: solved Issue is closed as solved and removed waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds in triage Presently being triaged by the triage team labels Mar 8, 2023
@leventkantaroglu
Copy link

I'm getting same problem after upgrading 3.7.7

Screenshot 2023-03-17 at 11 49 41

@cbenhagen
Copy link
Contributor

cbenhagen commented Mar 24, 2023

@cfsbhawkins, @leventkantaroglu, @Maatteogekko and others running into this, please consider to join the discussion at dart-code-checker/dart-code-metrics#1213 about fixing this in dart_code_metrics or other solutions.

@jacob314
Copy link
Contributor

jacob314 commented Apr 3, 2023

This restriction is now documented on the dart.dev website.
https://dart.dev/guides/language/analysis-options#plugins

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
r: solved Issue is closed as solved
Projects
None yet
Development

No branches or pull requests

6 participants