Relative Content

Tag Archive for fluttersharedpreferences

Can’t build ios with shared prefernces

The shared preferences plugin is not working on my Flutter App for IOS. Whenever I install the plugin in pubspec.yaml, and run flutter clean, flutter pub get and flutter build ios on cd ios directory I get this error.

Flutter SharedPreferences cant reflect data correctly

Future<void> initializeExerciseData() async { SharedPreferences prefs = await SharedPreferences.getInstance(); if (!prefs.containsKey(‘exercises_initialized’)) { Map<String, bool> initialData = { ‘arithmetic_completed’: false, ‘arithmetic_addSubOne’: false, ‘arithmetic_addSubTwo’: false, ‘arithmetic_addSubThree’: false, }; // Set Data To Shared Prefs initialData.forEach((key, value) { prefs.setBool(key, value); }); // Set Exercise Inıt To Shared Prefs prefs.setBool(‘exercises_initialized’, true); } } Category Screen (Such as Arithmetic) Future<void> […]

Flutter SharedPreferences cant reflect data correctly

Future<void> initializeExerciseData() async { SharedPreferences prefs = await SharedPreferences.getInstance(); if (!prefs.containsKey(‘exercises_initialized’)) { Map<String, bool> initialData = { ‘arithmetic_completed’: false, ‘arithmetic_addSubOne’: false, ‘arithmetic_addSubTwo’: false, ‘arithmetic_addSubThree’: false, }; // Set Data To Shared Prefs initialData.forEach((key, value) { prefs.setBool(key, value); }); // Set Exercise Inıt To Shared Prefs prefs.setBool(‘exercises_initialized’, true); } } Category Screen (Such as Arithmetic) Future<void> […]

Issues iterating through shared preferences in Flutter

I have a bunch of ids stored in shared preferences as recipeIds. I want to loop through all of those ids and get the strings associated with them in. During my forEach loop, it only adds one id and then quits unexpectedly. Is there another way to get strings from shared preferences?