healthrian_ble_interface 1.3.2 healthrian_ble_interface: ^1.3.2 copied to clipboard
Healthrian BLE interface for multiple devices
import 'package:example/module/module.dart';
import 'package:flutter/material.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({
super.key,
});
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
final _module = CardioClick();
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Observer(
builder: (context) {
return StreamBuilder(
stream: _module.ble.streams.plotRTEcg,
builder: (context, snapshot) {
print(snapshot.data);
return Text(snapshot.data.toString());
},
);
}
),
),
floatingActionButton: Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
FloatingActionButton(
onPressed: _module.ble.connectAndRegister,
child: const Icon(Icons.bluetooth),
),
FloatingActionButton(
onPressed: _module.ecg?.start,
child: const Icon(Icons.play_arrow),
),
FloatingActionButton(
onPressed: _module.ecg?.stop,
child: const Icon(Icons.stop),
),
FloatingActionButton(
onPressed: _module.ble.disconnectDevice,
child: const Icon(Icons.bluetooth_disabled),
),
],
),
);
}
}