我该如何查找从flutter应用程序上从蓝牙发送的中断? StreamBuilder/FutureBuilder
我该如何查找从flutter应用程序上从蓝牙发送的中断?目前,我正在使用StreamBuilder尝试使用它,但这仅在应用程序的另一个状态更改时获取数据。
我的应用程序通过蓝牙连接到加速度计,我想在应用程序上流式传输和显示警报。
new Container(
padding: new EdgeInsets.only(left: 15),
child: new Column(children: <Widget>[
StreamBuilder<List<int>>(
stream: button_1?.value,
initialData: button_1?.lastValue,
builder: (c, snapshot) {
final value = snapshot.data;
final msg = new StringBuffer();
print("MSG IS HERE");
print(msg);
value?.forEach((v) {
msg.write(String.fromCharCode(v));
});
String at = '1';
return Text(
msg.toString() == ''
? alertMessage
: msg.toString(),
style: new TextStyle(
color: Colors.black,
fontWeight: FontWeight.w600,
fontSize: 16.0,
),
);
}),
How can I look for an interrupt sent over from Bluetooth on my Flutter app? Currently I am trying it with StreamBuilder but this is only getting the data when another state of the APP changes.
My App is connected to an accelerometer via bluetooth and I want to stream and display alerts on my app.
new Container(
padding: new EdgeInsets.only(left: 15),
child: new Column(children: <Widget>[
StreamBuilder<List<int>>(
stream: button_1?.value,
initialData: button_1?.lastValue,
builder: (c, snapshot) {
final value = snapshot.data;
final msg = new StringBuffer();
print("MSG IS HERE");
print(msg);
value?.forEach((v) {
msg.write(String.fromCharCode(v));
});
String at = '1';
return Text(
msg.toString() == ''
? alertMessage
: msg.toString(),
style: new TextStyle(
color: Colors.black,
fontWeight: FontWeight.w600,
fontSize: 16.0,
),
);
}),
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论