Questions tagged [flutter-sharedpreference]

Flutter plugin for reading and writing simple key-value pairs. Wraps NSUserDefaults on iOS and SharedPreferences on Android.

Wraps platform-specific persistent storage for simple data (NSUserDefaults on iOS and macOS, SharedPreferences on Android, etc.). Data may be persisted to disk asynchronously, and there is no guarantee that writes will be persisted to disk after returning, so this plugin must not be used for storing critical data.

Visit: shared_preferences

114 questions
0
votes
3 answers

how can i get value instead of Instance of 'Future'

I'm using flutter and I am trying to get a value from shared_preferences for firebase. i checked my cord doesn't work and uid was " Instance of 'Future' ". the solution i found was using setState but i can't use that because it's not in Widget…
0
votes
2 answers

shared_preferences throws exception when trying to save a string on ios

I can not save a string using shared_preferences plugin for iOS. Future> login(String username, String password) async { Map data = await auth(username, password); final prefs = await…
0
votes
2 answers

Inappwebview and Shared Preference URL I can't assign the url stored in Shared Preference

good evening. I'm trying to assign a Shared Preference url but the page doesn't load, it only works when I assign the value to a variable like this: String url = 'https://www.youtube.com/'; I have tried in many ways and I still have not been able…
0
votes
1 answer

Why is the `await` keyword often omitted when using the shared_preferences plugin?

While using shared prefs plugin it's common to explore code like below void saveList() async { final prefs = await SharedPreferences.getInstance(); prefs.setStringList("listKey", aList); //await isn't used } where setStringList returns a…
0
votes
0 answers

Flutter module used in iOS native app: Unhandled Exception with shared_preferences initialization - PlatformException(channel-error)

I have been searching on Stack Overflow for a long time, but I haven't found a suitable solution. Most of the answers either don't work or don't provide a clear answer, such as this post: SharedPreference giving "Unable to establish connection on…
0
votes
0 answers

Misbehaving Values of Shared Preferences in Flutter Web

Hello there I'm new to flutter development. I'm doing my FYP in Flutter. I'm developing Admin Panel of my app and for auth I used shared preferences. The problem is they work just fine when I hot reload the flutter app but as soon as I restart my…
0
votes
0 answers

How to share persistent storage between isolates in flutter?

I am using android_alarm_manager_plus to run a dart isolate. In that isolate, I modify some data and I want those changes to reflect in the main isolate. Likewise, I want changes made in the main isolate to reflect in the alarm isloate. What I have…
0
votes
1 answer

How to store response of an api in cache and call api after every 12 hours?

I have an api call that have list of images and text in json response, i want to store json in local and use it in the ui, The api should be called after every 12 hours and save data in cache or the internal storage. Api call is in the listscreen…
0
votes
2 answers

using Shared preferences with a change notifier

I'm trying to understand how to use shared preferences with a change notifier. I've created a basic app and I want to save a bool and a string from the change notifier using shared preferences. here is my main.dart: import…
0
votes
0 answers

Store incrementing text fields(used list view builder) with shared preference

I'm new to programming, and flutter. and trying to make a simple expense app model. whenever i press the floating button a new text field is created but i want to keep the number of text fields made and the value that added to the text field after…
0
votes
1 answer

I tried to get name from SharedPreferences method but when run code show null value in the console in flutter How to solve it?

In my code at the home page fetch user name from firestore database and that's display nicely in UI. I want pass that name to shared preference function and store there and use that name in another pages also. At my previous question I have solved…
Dasun Dola
  • 541
  • 2
  • 16
0
votes
1 answer

Saving list of objects locally on device with shared_preferences in Flutter

I created an app that can send IR signals in which you can add IR signals yourself. The signals are saved in an object list named Item with items as the objects. I want the names and signals saved locally on the device with the application running…
0
votes
2 answers

String stored in Shared Preferences is not loading at first in Flutter app

I have a project management app where the details of the project are displayed after pressing the 'more' icon button on a card. The details to be displayed include the project name and due date that are fetched from the database and then stored…
clio
  • 31
  • 7
0
votes
1 answer

Not able to see sharedpref folder in phone as well Getting this error :Exception has occurred. _CastError (Null check operator used on a null value)

Hello Guys I am new to flutter and working on a flutter project. Below is the code of my splash screen. What I am doing is when the app launched we get the data from sharedpreference if we got the data we attempt to login from the data if it's…
Mr Fin
  • 85
  • 8
0
votes
1 answer

Why does Flutter shared_preferences download an older version without null safety?

I'm trying to add shared_preferences to a Flutter project. By default, version 0.5.7+3 is downloaded which isn't null safe. Adding the latest version, 2.0.15, gets the following error: Running "flutter pub get" in platform... …
tooba
  • 551
  • 5
  • 22