v1.1.3
bluetoothadapter
一个 Flutter 插件,用于为 **仅 Android** 暴露蓝牙适配器的功能。
22喜欢 63近 30 天下载40Pub 分数
平台暂无数据
GeekyAnts/flutter-bluetooth-adapter open-source repository details.
以下为英文项目原文快照,最新内容请访问 GitHub。
A Flutter plugin to expose the features of Bluetooth Adapter for Android only.
The primary purpose of this project was to communicate between flutter and Rasburry Pie using Bluetooth.
For a full example please check /example folder. Here are only the most important parts of the code to illustrate how to use the library.
//Initiatinng the bluetooth adapter
Bluetoothadapter flutterbluetoothadapter = Bluetoothadapter();
//Listening to the connection status listener
String _connectionStatus = "NONE";
StreamSubscription _btConnectionStatusListener =flutterbluetoothadapter.connectionStatus().listen((dynamic status) {
setState(() {
_connectionStatus = status.toString();
});
});
//Listening to the recieved messages
String _recievedMessage;
StreamSubscription _btReceivedMessageListener = flutterbluetoothadapter.receiveMessages().listen((dynamic newMessage) {
setState(() {
_recievedMessage = newMessage.toString();
});
});
List<BtDevice> devices = await flutterbluetoothadapter.getDevices();
await flutterbluetoothadapter.getDevice(deviceAddress);
await flutterbluetoothadapter.startServer();
flutterbluetoothadapter.startClient(devices.indexOf(element), true);
flutterbluetoothadapter.sendMessage(messageString);
await flutterbluetoothadapter.checkBluetooth(); //returns bool
flutterbluetoothadapter.initBlutoothConnection(uuid);
依赖清单 2 项
{"sdk":"flutter"}{"sdk":"flutter"}先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗