Skip to content

Easy to use the wrong binaryMessenger handler set pattern on iOS #39870

@xster

Description

@xster

Somewhat related to #33099

Users might reasonably think that I better set up all my listeners before running the engine entrypoint so they might end up with a pattern like

let engine = FlutterEngine(name: "blah", project: nil)
engine.binaryMessenger.setMessageHandlerOnChannel("blah", binaryMessageHandler:...)
engine.run(withEntryPoint: nil)

But that may fail silently since the binaryMessenger is routing back through the engine which sends it to the IOSPlatformView which isn't created yet.

https://github.com/flutter/engine/blob/fc64cadb1f4044d4376cd5a6b58af37173c7d639/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm#L546.

We might want to turn the FML_DCHECK in front of it into something stricter or let the FlutterBinaryMessengerRelay just hold onto it while the engine is setting up.

By contrast, this issue can't happen on Android since the DartExecutor and FlutterJNI are setup on the FlutterEngine's constructor.

Metadata

Metadata

Assignees

No one assigned

    Labels

    engineflutter/engine related. See also e: labels.platform-iosiOS applications specifically

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions