Using DartPad, how do you stop the current program without losing all your code?
As it is, it seems there is only:
- a RUN button
- a RESET button (which wipes your code)
The answer is not:
- "just leave it running and click RUN again,"
(because evidently it doesn't stop the current code first, and in fact begins subsequent runs in parallel! ***)
- "just reload the browser tab"
(because what if you're needing to read rapidly changing console output? -- that would be gone)
*** You can verify this behavior with this code:
import 'dart:async';
void main() {
int iter = 0;
Timer myTimer = Timer.periodic(Duration(milliseconds: 10), (timer) {
iter++;
int temp = iter %1000;
print("iter = $iter");
print("iter %1000 = $temp");
});
}
Since DartPad can run Flutter apps, you can make your own Stop button.
Run code sample in DartPad.