Skip to content

Support overriding the implementation of a federated plugin #59657

Closed

Description

@IchordeDionysos

Use case

For devices, without GMS we want to override the default implementation of packages like firebase_auth.
To achieve this we want to implement the firebase_auth_platform_interface and use our custom class.

Proposal

In the federated plugin proposal by @amirh, there is a section about overriding the default implementation with a custom package:
https://docs.google.com/document/d/1LD7QjmzJZLCopUrFAAE98wOUQpjmguyGTN2wd_89Srs/edit#heading=h.zc9ie62xv82k

We thought something like this should be possible:

pubspec.yaml

dependencies: 
  firebase_auth: any
  firebase_auth_android_rest: any

And because the Flutter tool knows that firebase_auth_android_rest provides a custom implementation of the firebase_auth_platform_interface/firebase_auth package, it uses firebase_auth_android_rest and not firebase_auth for Android.

We don't know if this is possible yet.

Activity

  1. added
    p: toolingAffects the flutter_plugin_tools package
    packageflutter/packages repository. See also p: labels.
    c: proposalA detailed proposal for a change to Flutter
    c: new featureNothing broken; request for a new capability
    toolAffects the "flutter" command-line tool. See also t: labels.
    on Jun 17, 2020
  2. removed
    p: toolingAffects the flutter_plugin_tools package
    on Jun 17, 2020
  3. jonahwilliams commented on Jul 11, 2020

    @jonahwilliams
    Contributor

    This can already be done via pub dependency_overrides: https://dart.dev/tools/pub/dependencies#dependency-overrides

  4. creativecreatorormaybenot commented on Jul 11, 2020

    @creativecreatorormaybenot
    Contributor

    @jonahwilliams No, it cannot - unfortunately.

    What this issue is referring to is overriding implementations of federated plugins. The main pubspec.yaml of a federated plugin specifies the packages that create the platform implementations.

    This means that if you want to only override say the Android implementation of a federated plugin, you need to override the main package as well.

  5. jonahwilliams commented on Jul 11, 2020

    @jonahwilliams
    Contributor

    What this issue is referring to is overriding implementations of federated plugins. The main pubspec.yaml of a federated plugin specifies the packages that create the platform implementations.

    Yes, you can override dependencies of dependencies

  6. creativecreatorormaybenot commented on Jul 11, 2020

    @creativecreatorormaybenot
    Contributor

    @jonahwilliams Of course, but you cannot supply a different package for federated plugins (which is what this issue attempts to describe).

    Our use case is the following: we created the firebase_rest_auth plugin and this is supposed to be an Android replacement for the firebase_auth plugin.

    If you take a look at the installing guide, you will hopefully see what I mean 🙂

    We want to offer a Pub package that only replaces a platform implementation of a federated plugin, however, that is currently not possible without overriding the actual plugin package.
    Even if we wanted to override the web implementation, which is in a separate package by default, we cannot do that with a different package.

    The only possible way would be a dependency override of firebase_auth_web, however, we cannot publish that on Pub because that obviously already exists.

    The section in the document @IchordeDionysos linked seems to indicate that replacing platform implementations should be supported - that is what this issue is about.


    I hope I was able to explain the issue better now 😄

  7. changed the title [-]Support overriding the default implementation of a package[/-] [+]Support overriding the implementation of a federated plugin[/+] on Jul 11, 2020
  8. jonahwilliams commented on Jul 11, 2020

    @jonahwilliams
    Contributor

    Updated the issue to be clear that this is an issue specifically for federated plugins

  9. 1 remaining item

  10. added
    a: pluginsSupport for writing, building, and running plugin packages
    on Feb 9, 2023
  11. added a commit that references this issue on Jul 11, 2024
    d55a5f9
  12. creativecreatorormaybenot commented on Jul 11, 2024

    @creativecreatorormaybenot
    Contributor

    🥳

  13. github-actions commented on Jul 25, 2024

    @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.

  14. locked as resolved and limited conversation to collaborators on Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projecta: pluginsSupport for writing, building, and running plugin packagesc: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterteam-toolOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.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