Method 1 (not sure)
You can use your method in main method then run the app.
But I do not now if this causes lateInit error.
void main() {
someFunction.then((value) {
runApp(MyApp);
})
}
Method 2
create boolean variable like loaded
set this to false
and then use ternary operator where you assign your widget needs the data.
if loaded
is false then load another widget not widget that needs data
use your function in initState when you functions completes set loaded
to true
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…