yanshouwang / bluetooth_low_energy

A Flutter plugin for controlling the bluetooth low energy.
https://pub.dev/packages/bluetooth_low_energy
MIT License
50 stars 16 forks source link

Error in Windows: Platform channel messages must be sent on the platform thread #66

Open askandlearn opened 6 months ago

askandlearn commented 6 months ago

Hello, I found an issue using this package on Windows 10. [√] Flutter (Channel stable, 3.16.9, on Microsoft Windows [Version 10.0.22631.3593], locale en-US) [√] Windows Version (Installed version of Windows is version 10 or higher) [√] Android toolchain - develop for Android devices (Android SDK version 33.0.0) [√] Chrome - develop for the web [√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.9.7) [√] Android Studio (version 2021.2) [√] VS Code (version 1.89.1) [√] Connected device (4 available) [√] Network resources

Steps to reproduce: 1) Run any flutter app which uses the CentralManager

Connecting to VM Service at ws://127.0.0.1:51793/-TN8a0R1R50=/ws flutter: BLE: central manager state changed [ERROR:flutter/shell/common/shell.cc(1015)] The 'dev.flutter.pigeon.bluetooth_low_energy_windows.MyCentralManagerFlutterApi.onDiscovered' channel sent a message from native to Flutter on a non-platform thread. Platform channel messages must be sent on the platform thread. Failure to do so may result in data loss or crashes, and must be fixed in the plugin or application code creating that channel. See https://docs.flutter.dev/platform-integration/platform-channels#channels-and-platform-threading for more information. flutter: Data Directory: C:\Users\xxxx\OneDrive\Documents

yanshouwang commented 6 months ago

This is blocked by this issue: https://github.com/flutter/flutter/issues/134346.

But this is not crash the app, you can ignore this warning for now.

askandlearn commented 6 months ago

Thanks for the reply @yanshouwang! The problem I have is that the bluetooth does not seem to work on Windows. The Windows version is unable to discover my device. If I compile the same app on Android, the device is detected. This is the error message that was shown. Were you able to discover devices on Windows?

Thanks for all your work on this flutter package. I have really liked it so far!

yanshouwang commented 6 months ago

What's the version you are using? Can you provide the scanning codes?

yanshouwang commented 5 months ago

Can you test this with 6.0.0 to see if this is resolved?

askandlearn commented 5 months ago

Sure, I will try, but it may take some time because I'm a bit swamped. The new 6.0 pub version looks great! Appreciate all your efforts on this. Very valuable library.

On Mon, Jun 3, 2024 at 10:23 PM 渐渐被你吸引 @.***> wrote:

Can you test this with 6.0.0 to see if this is resolved?

— Reply to this email directly, view it on GitHub https://github.com/yanshouwang/bluetooth_low_energy/issues/66#issuecomment-2146447261, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANMYGPGITXP3KTQ6B5YZORTZFUQKRAVCNFSM6AAAAABH3IYXFKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBWGQ2DOMRWGE . You are receiving this because you authored the thread.Message ID: @.***>

github-actions[bot] commented 4 months ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 4 months ago

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] commented 1 month ago

This issue is stale because it has been open for 30 days with no activity.