Skip to content

Windows: platform-thread warnings during Bluetooth discovery #6

Description

@translibrius

Hi, I’m seeing the following warnings when running Bluetooth discovery on Windows:

The 'flutter_classic_bluetooth/discovery_results' channel sent a message from native to Flutter on a non-platform thread.
The 'flutter_classic_bluetooth/discovery_state' channel sent a message from native to Flutter on a non-platform thread.

Discovery still appears to work, but Flutter notes that this may result in lost messages or crashes.

Looking at the Windows implementation, HandleStartDiscovery runs discovery in a background std::thread. The discovery result events and final discovery state event appear to be sent directly from that thread.

Environment

  • flutter_classic_bluetooth: 0.1.5
  • Flutter: 3.44.1
  • Platform: Windows

Steps to reproduce

  1. Listen to the discovery state and results streams.
  2. Start Bluetooth discovery.
  3. Observe the warnings in the application output.

Flutter threading documentation:
https://docs.flutter.dev/platform-integration/platform-channels#channels-and-platform-threading

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions