Created
April 2, 2024 20:06
-
-
Save fabiancrx/ed5641497057f06b0b86f655c0bdab42 to your computer and use it in GitHub Desktop.
Eager vs late
This file contains hidden or 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
| void main() async{ | |
| final sample=Sample(); | |
| await Future.delayed(Duration(milliseconds:100)); | |
| for(int i=0;i<5;i++){ | |
| print(i); | |
| sample.averageReading; | |
| sample.averageReading2; | |
| } | |
| } | |
| int computedValue([String? text]) { | |
| final n = 9; | |
| print('$text $n'); | |
| return n; | |
| } | |
| class Sample{ | |
| late final int averageReading = computedValue("late"); | |
| final int averageReading2 = computedValue("eager"); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment