sharedpreferences

Attempt to invoke virtual method 'android.content.SharedPreferences android.content.Context.getSharedPreferences

穿精又带淫゛_ 提交于 2021-01-29 02:35:54
问题 I'm trying to save Json object which I got from Json URL to favorite list using SharedPreferences but The app crashes every time when I try to save Json Array with next error: 06-27 18:36:03.224 933-933/? E/EGL_emulation﹕ tid 933: eglCreateSyncKHR(1237): error 0x3004 (EGL_BAD_ATTRIBUTE) 06-27 18:36:27.496 2778-2778/? E/memtrack﹕ Couldn't load memtrack module (No such file or directory) 06-27 18:36:27.496 2778-2778/? E/android.os.Debug﹕ failed to load memtrack module: -2 06-27 18:36:27.943

Using FutureBuilder in main.dart

久未见 提交于 2021-01-28 22:03:43
问题 Below code always show OnboardingScreen a little time (maybe miliseconds), after that display MyHomePage. I am sure that you all understand what i try to do. I am using FutureBuilder to check getString method has data. Whats my fault ? Or any other best way for this ? saveString() async { final prefs = await SharedPreferences.getInstance(); prefs.setString('firstOpen', '1'); } getString() method always return string. getString() async { final prefs = await SharedPreferences.getInstance();

Anyway to enable 'remember me' function using sharedPreferences in flutter?

ぃ、小莉子 提交于 2021-01-28 10:18:38
问题 Currently, I have enabled 'keep logging in' function if the user log in once successfully. However, I still want to make a 'remember me' checkbox to save the success login information for user. Can anyone please help me with this? Need: a checkbox that enables the user to store email and password if the user logged in once successfully. Code is shown below: signIn(String email, pass) async { SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); String url =

flutter run failed: A problem occurred configuring project ':shared_preferences'

拜拜、爱过 提交于 2021-01-28 03:33:45
问题 I am Using flutter 1.2 and my project runs successfully before I add shared_preferences package to it.I am using shared_preferences: ^0.5.1+2. after I add it, flutter run command creates this error: Error running Gradle: ProcessException: Process "/home//Desktop/projects/fycx/android/gradlew" exited abnormally: Starting a Gradle Daemon, 1 busy Daemon could not be reused, use --status for details Configure project :shared_preferences Project evaluation failed including an error in

Android app data storage keeps increasing

十年热恋 提交于 2021-01-27 12:57:28
问题 I am developing an android app that basically loads up a list of news articles and opens them up in a webview upon user click. What I'm wondering about is when I look at my app details in 'Settings->Applications->Manage Applications', the Total storage size keeps increasing. Particularly, the data storage size is increasing. The Application size of course, is fixed. From what I know, the sharedpreferences take up data storage. I don't know what else. In my app, I just have 1 checkbox

kotlin.UninitializedPropertyAccessException: lateinit property preferences has not been initialized

…衆ロ難τιáo~ 提交于 2021-01-04 10:22:16
问题 I used the code of shared preference in my multiple project and it worked correctly but now when i apply the same code in another project it stopped working. following is error kotlin.UninitializedPropertyAccessException: lateinit property preferences has not been initialized Shared preferences code object AppPrefrence { private const val NAME = "AComputerEngineer" private const val MODE = Context.MODE_PRIVATE private lateinit var preferences: SharedPreferences private val user_id = Pair(

kotlin.UninitializedPropertyAccessException: lateinit property preferences has not been initialized

ε祈祈猫儿з 提交于 2021-01-04 10:21:50
问题 I used the code of shared preference in my multiple project and it worked correctly but now when i apply the same code in another project it stopped working. following is error kotlin.UninitializedPropertyAccessException: lateinit property preferences has not been initialized Shared preferences code object AppPrefrence { private const val NAME = "AComputerEngineer" private const val MODE = Context.MODE_PRIVATE private lateinit var preferences: SharedPreferences private val user_id = Pair(

AndroidX Security EncryptedSharedPreferences v1.1.0 /w API 21 issue

筅森魡賤 提交于 2021-01-02 05:42:07
问题 I decided to use new EncryptedSharedPreferences from AndroidX Security library. Since the app is supporting API 21 and higher, I decided to try out this new v1.1.0-alpha02 version, since it supports API 21+ So, I succeded to make the implementation for API 23+, but for older versions where Android KeyStore is not supported, I couldn't make it right, and there are no exact instructions how the master key should be created to make it work somehow. The code for initializing SharedPrefs:

AndroidX Security EncryptedSharedPreferences v1.1.0 /w API 21 issue

牧云@^-^@ 提交于 2021-01-02 05:40:25
问题 I decided to use new EncryptedSharedPreferences from AndroidX Security library. Since the app is supporting API 21 and higher, I decided to try out this new v1.1.0-alpha02 version, since it supports API 21+ So, I succeded to make the implementation for API 23+, but for older versions where Android KeyStore is not supported, I couldn't make it right, and there are no exact instructions how the master key should be created to make it work somehow. The code for initializing SharedPrefs:

How to set dynamic initialRoute based on sharedPrefs value in flutter?

让人想犯罪 __ 提交于 2020-12-30 02:39:08
问题 Currently, I am working around routes and i wanted to set initialRoute in my app based on sharedPreferences value. I am using Statedulwidget for my MaterialAppWidget and using setState() method once the data from sharedPrefs is fetched. But, every time i am getting the same screen. class MyApp extends StatefulWidget { @override _MyAppState createState() => _MyAppState(); } class _MyAppState extends State<MyApp> { int initScreen = 0; initPrefs() async { SharedPreferences prefs = await