0

I'm encountering an issue with step count tracking in my Flutter app. Here's a summary of the problem:

I have implemented step count functionality using the pedometer plugin in my Flutter project. The step count is displayed on the home page of my app. When the user successfully sends the step count to the backend, I want to subtract that count from the displayed step count.

The problem I'm facing is as follows:

  • Upon successfully sending the step count to the backend, I need to subtract the sent count from the displayed step count.
  • However, if the user sends the step count multiple times (due to network delays or other reasons), the displayed step count gets subtracted multiple times as well, leading to an incorrect step count.

I'm seeking guidance on the following points:

  • How can I ensure that the sent step count is subtracted only once from the displayed step count, even if the user sends it multiple times?
  • Is there a recommended approach or best practice for handling such scenarios where duplicate step count submissions can occur?

I changed the package code, to reset _steps to 0, and start count again

0 Answers0