callibri_ecg 1.0.0
callibri_ecg: ^1.0.0 copied to clipboard
Flutter wrapper for CallibriECG library
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:callibri_ecg/callibri_ecg.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
late final CallibriEcgMath math;
@override
void initState() {
super.initState();
int samplingRate = 500;
int dataWindow = samplingRate ~/ 2;
int nWinsForPressureIndex = 30;
math = CallibriEcgMath(samplingRate, dataWindow, nWinsForPressureIndex);
}
@override
void dispose() {
super.dispose();
math.dispose();
}
void run() {
final samples = List<double>.generate(100, (i) => i * 0.006);
math.push(samples);
math.process();
print("""
hr: ${math.hr}
moda: ${math.moda}
amplitudeModa : ${math.amplitudeModa}
lastRPeakIndex: ${math.lastRPeakIndex}
pressureIndex: ${math.pressureIndex}
rr: ${math.rr}
variationDistance: ${math.variationDistance}
isInitialSignalCorrupted: ${math.isInitialSignalCorrupted}
isRRDetected: ${math.isRRDetected}
""");
math.clear();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: ElevatedButton(
onPressed: run,
child: const Text("Run"),
),
),
),
);
}
}