Skip to content

Instantly share code, notes, and snippets.

@nsmirosh
Last active August 14, 2020 14:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nsmirosh/924e9ae4504a898497d6db32ae4e2abb to your computer and use it in GitHub Desktop.
Save nsmirosh/924e9ae4504a898497d6db32ae4e2abb to your computer and use it in GitHub Desktop.
event loop process demonstration
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: RaisedButton(
onPressed: () {
print("first event is processed by the event loop!");
Future.delayed(Duration(seconds: 3), () => "completed Future value")
.then((value) {
print("second event is processed by the event loop!");
print('Future completed with a value : $value');
});
},
child: Text("click me!")),
));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment