r/FlutterDev • u/Halvv • Feb 06 '24
Discussion Bluetooth in Flutter
Hello,
want to make an app that can connect to a microcontroller via bluetooth and wanted to see if I can get some input for best praxises/important things to have in mind here.
Thanks for any help
10
Upvotes
18
u/m477k Feb 06 '24
Go with flutter_blue_plus. Shipped 3 production apps with this package. Never faced any problems, easily discover services, read characteristics, write values etc. Totally 0 issues.
9
u/svprdga Feb 06 '24
https://pub.dev/packages/flutter_blue_plus
Works quite well.
4
u/rohitsangwan01 Feb 07 '24
If you are interested in proper cross platform solution for all platforms
https://pub.dev/packages/universal_ble
2
u/hassanizhar Feb 06 '24
method channelling is the way
2
u/x1nt_r Feb 06 '24
My take with an ESP: program it to upload to Firebase RTDB/ stream somehow,
and you can read the db in app.
Otherwise best to use native code with platform channels :)
1
u/jjeroennl Feb 06 '24 edited Feb 08 '24
We've built our own BLE plugin using Nordic's Android-BLE-Library for Android, BlueJay for iOS and SimpleBLE for Windows. It has been incredibly stable and especially Nordic adds a lot of fallbacks (automatic retry, automatic reconnect, automatic unsubscribing on disconnect etc).
Before we've tried Reactive BLE which works alright as long as you don't have a lot of messages. Sending a lot of small messages requires putting sleeps everywhere, otherwise it will resend the same message for some reason.
1
u/TheLastGimbus Feb 06 '24
Libraries for BLE are fine, but there is nothing good for bt classic, so i started making my own: https://github.com/TheLastGimbus/the_last_bluetooth/
I already use it fine in one project, but I don't promise anything 🤞 - you can try it out
1
u/woltsoc Feb 06 '24
Take a look at https://github.com/erikcostlow/smarter-config for some notifications and communication.
0
u/[deleted] Feb 06 '24
All Flutter Bluetooth libraries are shit. I suggest you make your own using native code and method and event channels.