Skip to content

Instantly share code, notes, and snippets.

@fabiancrx
Created April 2, 2024 20:06
Show Gist options
  • Save fabiancrx/ed5641497057f06b0b86f655c0bdab42 to your computer and use it in GitHub Desktop.
Save fabiancrx/ed5641497057f06b0b86f655c0bdab42 to your computer and use it in GitHub Desktop.
Eager vs late
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