Skip to content

Refactor Channel and Codec to be usable by platform side #29629

@harryterkelsen

Description

@harryterkelsen

There are already Java and Objective-C implementations of MethodChannel and the various other Channel and Codec classes for message passing. For plugins for the web platform and Fuchsia, Dart implementations of these classes are needed to decode messages from the client side, but these classes are in package:flutter and so are inaccessible from the platform side.

I suggest splitting these classes out into another package, say package:flutter_channels, and exporting most of the classes from package:flutter/services.dart. Some of the classes directly use BinaryMessages to communicate with the platform side, these can be refactored so that the BinaryMessages dependency is factored out, and in package:flutter we can have implementations MethodChannel in package:flutter which extends a BaseMethodChannel from package:flutter_channels by using BinaryMessages for passing binary messages.

Once we refactor the platform channels code into a platform-independent package, we'll be able to use the same Codec code for Flutter web plugins as in the Flutter framework.

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: new featureNothing broken; request for a new capabilityframeworkflutter/packages/flutter repository. See also f: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions