title: Timer inside flutter isolate not stopping when isolate is killed
body: <p>I have an app uploading joystick position data to a webserver using an API call.</p>
  <p>This method gets called when a joystick is moved. It stops any previously running isolate and starts a new isolate if the joystick is not in the centre.</p>
  <pre><code>void onJoystickMoved(double angle, double distance) {
  stopIsolate();
  if(distance &gt; 0.06){
    startIsolate(JoystickPosition.fromDistanceAndRadius(distance, angle));
  }
  }
  </code></pre>
  <p>The isolate start and stop methods</p>
  <pre><code>Future&lt;void&gt; startIsolate(JoystickPosition position) async {
     isolate = await Isolate.spawn(uploadJoystickPosition, position);
  }
  
  void stopIsolate() {
     if (isolate != null) {
       debugPrint(&quot;Stopping isolate&quot;);
       isolate.kill();
       isolate = null;
     }
  }
  </code></pre>
  <p>uploadJoystickPosition method (the method in the isolate):</p>
  <pre><code>void uploadJoystickPosition(JoystickPosition position){
  
     Timer.periodic(new Duration(seconds: 1), (Timer t) {
        DataModel dataModel = DataModel(1, getTimeInSeconds());
        dataModel.joystickPosition = position;
        debugPrint(&quot;Distance: ${position.distance}&quot;);
        uploadData(dataModel).then(uploadResponse, onError: uploadError);
     });
  }
  </code></pre>
  <p>Trouble is the uploadJoystickPosition keeps uploading old positions of the joystick along with new positions. I am assuming this is because the timer keeps running even when the isolate is killed.</p>
  <p>Questions:</p>
  <ol>
  <li>Why does my timer keep going(and uploading) even after I kill the isolate?</li>
  <li>How do I get my timer to stop when I kill the isolate its running in?</li>
  </ol>