workout 0.0.2 copy "workout: ^0.0.2" to clipboard
workout: ^0.0.2 copied to clipboard

outdated

Run a workout session on Wear OS and Tizen. Get data such as heart rate in real time.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:workout/workout.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  double heartRate = 0;

  _MyAppState() {
    final workout = Workout();
    workout.start([WorkoutSensor.heartRate]);
    workout.stream.listen((event) {
      print('${event.sensor}: ${event.value}');
      if (event.sensor == WorkoutSensor.heartRate) {
        setState(() {
          heartRate = event.value;
        });
      }
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Text('Heart rate: $heartRate'),
        ),
      ),
    );
  }
}
15
likes
0
pub points
73%
popularity

Publisher

verified publisherrexios.dev

Run a workout session on Wear OS and Tizen. Get data such as heart rate in real time.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

enum_to_string, flutter, permission_handler, permission_handler_tizen

More

Packages that depend on workout