sfit_step_counter 0.0.21 copy "sfit_step_counter: ^0.0.21" to clipboard
sfit_step_counter: ^0.0.21 copied to clipboard

A lightweight Flutter package that detects steps in real-time using sensors_plus and provides calories, cadence, geofencing, and walking state.

example/sfit_step_counter_example.dart

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

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  final stepCounter = StepCounter();
  await stepCounter.init(weightKg: 70, heightMeters: 1.75);
  await stepCounter.start();

  runApp(MyApp(stepCounter: stepCounter));
}

class MyApp extends StatelessWidget {
  final StepCounter stepCounter;
  const MyApp({required this.stepCounter});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('Step Counter')),
        body: StreamBuilder<StepData>(
          stream: stepCounter.stepStream,
          builder: (context, snapshot) {
            final data = snapshot.data;
            if (data == null) return Center(child: CircularProgressIndicator());

            return Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                Text('Steps: ${data.steps}'),
                Text('Calories: ${data.calories.toStringAsFixed(2)} kcal'),
                Text('Speed: ${data.speedKmh.toStringAsFixed(2)} km/h'),
                Text('Cadence: ${data.cadence.toStringAsFixed(2)} spm'),
                Text('Status: ${data.status}')
              ],
            );
          },
        ),
      ),
    );
  }
}
4
likes
120
points
3
downloads

Publisher

unverified uploader

Weekly Downloads

A lightweight Flutter package that detects steps in real-time using sensors_plus and provides calories, cadence, geofencing, and walking state.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, flutter_background, sensors_plus, shared_preferences

More

Packages that depend on sfit_step_counter