2021-12-09

Tech Programing

程式人小天地

I want to use FutureBuilder in build() and let initState run first

1 min read


class _MyAppState extends State<MyApp> {
@override
void initState() {
getMySavedLang();
 super.initState();

}
here i want to add FutureBuilder to let initState work first

Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
 return MultiProvider(
providers: [
ChangeNotifierProvider<User>(
create: (context) => User(),
child: GetMaterialApp(
translations: Mytrans(),
locale: Get.deviceLocale,
localizationsDelegates: Get.delegate(),
debugShowCheckedModeBanner: false,
),
 home: loginPage(),
),

please can help



Source link

資料來源:Stackoverflow

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *