'stop watch timer on flutter. How can I print the time in the terminal while pressing a button?
What I would like to do is printing the current time on the terminal while pressing the reset button.
ElevatedButton(
onPressed: () {
_stopWatchTimer.onExecute.add(StopWatchExecute.reset);
setState(() {
showDialog(
barrierColor: Colors.black12.withOpacity(.6),
context: context,
builder: (_) {
return Dialog(
elevation: 0,
backgroundColor: Colors.transparent);
});
});
before the line _stopWatchTimer.onExecute.add(StopWatchExecute.reset);
I would like to insert print() which would allow me to see the current time of my stopwatch timer on the terminal. The point is that I don't know what can I put inside the brackets of my print().
Into the class _MyAppState extends State<MyApp>
, into the return Scaffold(...)
I have a Streamibuilder where I have declared final value = snap.data;
but I cannot access this variable "value" because the widget ElevatedButton is not within the StreamBuilder.
Thanks a lot for any kinf od help.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|