What is the correct way to get the value which has been stored using sharedPreferences to widget?
问题 What is the correct way to get the value which has been stored using sharedPreferences to widget? PageA @override void initState() { super.initState(); sharedPreferences = SampleSharedPreferences().getData(); sharedPreferences.then((onValue) { name = onValue.name; // I debug this line, I can see the value }); } @override Widget build(BuildContext context) { return Scaffold( body: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( child: