Skip to content

Federate the Android and iOS implementations of 1P plugins #68498

@MisterJimson

Description

@MisterJimson

Use case

From the flutter docs: https://flutter.dev/docs/development/packages-and-plugins/developing-packages#federated-plugins

Federated plugins are a a way of splitting support for different platforms into separate packages. So, a federated plugin can use one package for iOS, another for Android, another for web, and yet another for a car (as an example of an IoT device). Among other benefits, this approach allows a domain expert to extend an existing plugin to work for the platform they know best.

This seems at odds with the official plugins not having the Android and iOS implementations in separate projects.

Looking at shared_preferences as an example: https://github.com/flutter/plugins/tree/master/packages/shared_preferences

Why are web and desktop in separate packages but Android and iOS are not? If we want to swap the implementation of Android or iOS, the default implementation is still present. Why are they special?

Proposal

Treat all platforms the same, 1 package per platform.

Here is an example of what I am calling "fully federated", where there is no platform implementations in the app facing package: https://github.com/MisterJimson/federated_plugins_example/tree/fully-federated

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: contributor-productivityTeam-specific productivity, code health, technical debt.packageflutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyplatform-iosiOS applications specifically

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions