title: how to reset the step counter flutter
body: <p>I want to calculate the steps using flutter 
  and found this plugin
  <a href="https://pub.dev/packages/flutter_pedometer" rel="nofollow noreferrer">https://pub.dev/packages/flutter_pedometer</a></p>
  
  <p>but can't reset the counter to 0 even when i close the app it still the old counter</p>
  
  <p>I tried to recall the initPlatformState() method again but didn't work</p>
  
  <blockquote>
    <p>if you have another way or plugin please share it</p>
  </blockquote>
  
  <p><strong>update</strong> it resets only if i restart the device.</p>
  
  <pre><code>import 'package:flutter/material.dart';//
  import 'dart:async';//
  
  import 'package:flutter_pedometer/flutter_pedometer.dart';//package name
  
  void main() =&gt; runApp(new MyApp());
  
  class MyApp extends StatefulWidget {
    @override
    _MyAppState createState() =&gt; new _MyAppState();
  }
  
  class _MyAppState extends State&lt;MyApp&gt; {
    String _stepCountValue = 'Unknown';
    StreamSubscription&lt;int&gt; _subscription;
  
    @override
    void initState() {
      super.initState();
      initPlatformState();
    }
  
    // Platform messages are asynchronous, so we initialize in an async method.
    Future&lt;void&gt; initPlatformState() async {
      FlutterPedometer pedometer = new FlutterPedometer();
      _subscription = pedometer.stepCountStream.listen(_onData,
          onError: _onError, onDone: _onDone, cancelOnError: true);
  
      // If the widget was removed from the tree while the asynchronous platform
      // message was in flight, we want to discard the reply rather than calling
      // setState to update our non-existent appearance.
      if (!mounted) return;
    }
  
    void _onData(int stepCountValue) async {
      print(stepCountValue);
  
      setState(() {
        _stepCountValue = "$stepCountValue";
      });
    }
  
    void _onDone() {}
  
    void _onError(error) {
      print("Flutter Pedometer Error: $error");
    }
  //
    @override
    Widget build(BuildContext context) {
      return new MaterialApp(
        home: new Scaffold(
          appBar: new AppBar(
            title: const Text('Plugin example app'),
          ),
          body: new Center(
            child: new Text('Steps taken: $_stepCountValue\n'),
          ),
        ),
      );
    }
  }
  </code></pre>