title: Stop Timer periodic on other dateTime/NTPTime Flutter
body: <p>I have 2 function that call <code>NTP</code> to get local date time. First one is working like a clock using <code>Timer.periodic</code> and the second one for get the time when user tapped the button. But when I display the time in the second function its still runing the <code>Timer.periodic</code>. How to avoid that? Thanks</p>
  <p>My Code:</p>
  <pre><code>Future&lt;String&gt; getNTPTime() async {
  DateTime startDate = await NTP.now();
  String currentDate = DateFormat('d MMMM yyyy').format(startDate);
  String currentTime = DateFormat('kk : mm : ss').format(startDate);
  print('NTP DateTime: $startDate');
  
  if (mounted) {
    setState(() {
      _currentDate = currentDate;
      _currentTime = currentTime;
    });
  }}
  
  Future&lt;String&gt; getNTPTimeIn() async {
  DateTime ntpTimeIn = await NTP.now();
  
  String timeIn = DateFormat('kk : mm : ss').format(ntpTimeIn);
  print('NTP DateTime: $ntpTimeIn');
  
  
  if (mounted) {
    setState(() {
      _ntpTimeIn = timeIn;
    });
  }}
  </code></pre>
  <p>and call it in the initState</p>
  <pre><code>@override
  super.initState();
  getNTPTime();
  Timer.periodic(Duration(seconds: 1), (timer) =&gt; getNTPTime());
  }
  </code></pre>
  <p>when I display the <code>_ntpTimeIn</code> the <code>Timer.periodic</code> is still running.</p>