Nhan Cao

Jul 16, 2020

1 min read

Flutter: run task after widget render

code

@override
void initState() {
super.initState();
print('init');
Future<dynamic>.microtask(() {
print('after init with micro task');
});
SchedulerBinding.instance.addPostFrameCallback((_) {
print('after init with scheduler binding');
});
WidgetsBinding.instance.addPostFrameCallback((_) {
print('after init with widgets binding');
});
}
@override
void didChangeDependencies() {
super.didChangeDependencies();
print('didChangeDependencies');
}