I'am building a simple pedometer application using flutter with pedometer package. When I start the application, it starts constantly counting steps. I want to have a button to start and pause the counting (thinking about putting a timer later for how many steps the user takes in an hour)
And I'm using this example code: https://github.com/cph-cachet/flutter-plugins/blob/master/packages/pedometer/example/lib/main.dart
You have to keep track of the count yourself and remember the count when the user pressed reset like 11230 equals 0 and subtract that offset. Basically, Flutter doesn't have a way to reset the pedometer data as the app is listening to the sensor data through a stream, a stream input data can not be stopped once activated.
What you can do is store the total steps of a day in a variable then substract it to make it zero when its the next day using current time with a loop, you can store the previous steps of the day in separate variables to show the steps of the previous and next day.
Make 7 variables to store the steps of 7 days.