Issue I am trying to implement a class where i can call SharedPreferences funtions. import ‘package:shared_preferences/shared_preferences.dart’; class UserPreferences { static SharedPreferences _preferences; static const _keyToken = ‘token’; static Future init() async { _preferences = await SharedPreferences.getInstance(); } static Future setToken(String
Continue readingTag: flutter-sharedpreference
Flutter Json FormatException
Issue In my application, i’m trying to retrieve the data from shared preferences and pass that value to the provider. How ever im getting a exception FormatException (FormatException: Unexpected character (at character 2) {token: eyJh… ^ The function to get
Continue readingThe argument type 'String?' can't be assigned to the parameter type 'String' because 'String?' is nullable and 'String' isn't in Text widget
Issue I am trying to display the name and email of the person when he logs in to the profile screen using Getx Column( children: [ Text( controller.userModel!.name, style: TextStyle( fontSize: 20, fontWeight: FontWeight.w600, color: Kprimarycolor, ), ), Text( controller.userModel!.email,
Continue readingI'm trying to implement a favorites feature locally in flutter that works both inside the page and on the select page
Issue I’m trying to add a favorites feature with flutter. If you activate it by clicking the Favorites button inside the page, you need to implement it so that the Favorites page marked as Favorite appears in the page selection
Continue readingHow to create a bool list in shared_preferences and store values there
Issue required this.favorite, I got the bool value from the previous page like this. Since I used the pageview, I want to store the value in the index like this and use it later. loadFavorite() async{ SharedPreferences prefs = await
Continue readingFuture builder runs forever, if memoizer used doesnt notify to the listerners
Issue I am trying to switch the drawer tab, according to the value stored in shared preferences using the following code. code works fine when memoizer is not used but future builder runs forever. If I use memorizer future builder
Continue readingFlutter SharedPreferences Null check operator used on a null value
Issue I’ve made a class for shared preferences. The class is as follows class StorageUtil { static StorageUtil? _storageInstance; static SharedPreferences? _preferences; static Future<StorageUtil?> getInstance() async { if (_storageInstance == null) { _storageInstance = StorageUtil(); } if (_preferences == null)
Continue readingHow to access Flutter's shared preference file?
Issue I am pretty new to flutter and currently, I am writing an app that needs to store key-value pairs to disk and read it each time the app is open. I based on this document, using shared preference package,
Continue readinginitializing variables before build in flutter?
Issue I am trying to initialize a variable in the initstate. Before initializing null value is used in my scaffold. How can I wait for a variable then later load the build?I am using shared_preference plugin. This is my initstate:
Continue readingFlutter & Shared Preferences: How do i save and read back a List<Object> using setStringList? Also, how do i remove a specific object from the List?
Issue class Restaurant { Restaurant({ required this.name, required this.description, required this.address, required this.imageUrl, }); Restaurant.fromJson(Map<String, Object?> json) : this( name: json[‘name’]! as String, description: json[‘description’]! as String, address: json[‘address’]! as String, imageUrl: json[‘imageUrl’] as String, ); final String name; final
Continue reading