Skip to content

generated_main.dart should using alias import #100421

Closed

Description

@ekasetiawans

Use case

Since flutter generate generated_main.dart inside .dart_tool/flutter_build for every plugins that implement dartPluginClass, there was possible issue when two or more different plugins has same dartPluginClass.

Proposal

To avoid conflicts in _PluginRegistrant.register method, we can use alias imports e.g

import 'package:foo/foo.dart' as p1;
import 'package:bar/bar.dart' as p2;
...

then we call registerWith method like this

p1.SomePluginClass.registerWith();
p2.SomePluginClass.registerWith();

Activity

  1. added
    in triagePresently being triaged by the triage team
    toolAffects the "flutter" command-line tool. See also t: labels.
    c: proposalA detailed proposal for a change to Flutter
    and removed
    in triagePresently being triaged by the triage team
    on Mar 21, 2022
  2. added
    fyi-ecosystemFor the attention of Ecosystem team
    and removed on Aug 2, 2023
  3. christopherfujino commented on Aug 2, 2023

    @christopherfujino
    Contributor

    @stuartmorgan WDYT about this proposal. it sounds reasonable to me.

  4. added
    P2Important issues not at the top of the work list
    triaged-toolTriaged by Flutter Tool team
    on Aug 2, 2023
  5. stuartmorgan-g commented on Aug 2, 2023

    @stuartmorgan-g
    Contributor

    Yes, that was just an oversight. We should import as {{pluginName}} in the template.

  6. stuartmorgan-g commented on Aug 2, 2023

    @stuartmorgan-g
    Contributor

    @ekasetiawans Have you hit this with actual plugins in the wild? If so, we should prioritize fixing this.

  7. ekasetiawans commented on Aug 3, 2023

    @ekasetiawans
    Author

    @stuartmorgan Not yet, but this has the potential to become an issue. You can fix it later.

  8. added
    a: pluginsSupport for writing, building, and running plugin packages
    on Aug 3, 2023
  9. 2 remaining items

  10. added
    tool-still-validIssues that have been deemed still valid as part of the Flutter Tools issue cleanup initiative.
    on Jul 11, 2025
  11. self-assigned this
    on Jul 11, 2025
  12. github-actions commented on Aug 6, 2025

    @github-actions

    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.

  13. locked as resolved and limited conversation to collaborators on Aug 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: pluginsSupport for writing, building, and running plugin packagesc: proposalA detailed proposal for a change to Flutterteam-toolOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.tool-still-validIssues that have been deemed still valid as part of the Flutter Tools issue cleanup initiative.triaged-toolTriaged by Flutter Tool team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions