Created
August 18, 2020 16:04
-
-
Save 702x/24a798189ac096e688f8301f0e2381f2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:io'; | |
import 'package:flutter/material.dart'; | |
class With10SecondDelay extends StatelessWidget { | |
runningFunction() { | |
int sum = 0; | |
for (int i = 1; i <= 10; i++) { | |
sleep(Duration(seconds: 1)); | |
print(i); | |
sum += i; | |
} | |
return "total sum is $sum"; | |
} | |
pauseFunction() { | |
//pause function is not async | |
print(runningFunction()); | |
} | |
@override | |
Widget build(BuildContext context) { | |
pauseFunction(); | |
return Material( | |
child: Center( | |
child: Center( | |
child: Text( | |
"Tnx for waiting 10 seconds : check console for response", | |
style: TextStyle( | |
fontSize: 50, | |
), | |
), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment