-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Description
In our app we have situations where we need to reload shared preferences,
because another isolate has updated them.
We then call
final prefs = await SharedPreferences.getInstance();
await prefs.reload();If our app, somewhere else in the code and at the same time, calls another
async method like this :
storeValue(String value) async {
final prefs = await SharedPreferences.getInstance();
await prefs.setString("myKey", value);
}We often lose the setting of the myKey - value.
It seems to be available on disk, but not in flutter.
If we reload again, it will be available in flutter again.
The attached test App has been tested on:
- Huawei P30 Pro
- Sony xz2 compact
- Moto G4
and the issue can be reproduced on all of them.
We have also tested this on iOS, but there we don't see this issue.
It seems to me that the shared_preferences plugin should synchronize the settings calls and the reload call.
Steps to Reproduce
- Execute
flutter runon the code sample - Click on the + FAB
- See the log output
Expected results:
The logged line after 10ms should always look like this:
Reading after 10ms key my_test_key : gold
Actual results:
We often see this :
Reading after 10ms key my_test_key : null
Which indicates a data loss in flutter
Code sample
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key, required this.title}) : super(key: key);
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'You have pushed the button this many times:',
),
Text(
'Test',
style: Theme.of(context).textTheme.headline4,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _testSharedPrefs,
tooltip: 'Increment',
child: const Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
_testSharedPrefs() async {
final prefs = await SharedPreferences.getInstance();
final key = "my_test_key";
print("\n\n");
await prefs.remove(key);
await Future.delayed(const Duration(milliseconds: 100));
_setIt(key, prefs);
_reloadIt(prefs);
//Reload again after 100ms brings the value back into flutter.
await Future.delayed(const Duration(milliseconds: 100));
await prefs.reload();
print('Reloading after 100ms key $key : ${prefs.getString(key)}');
}
_setIt(String key,SharedPreferences prefs) async {
print('Setting key $key with value gold');
await prefs.setString(key, "gold");
await Future.delayed(const Duration(milliseconds: 10));
print('Reading after 10ms key $key : ${prefs.getString(key)}');
}
_reloadIt(SharedPreferences prefs) async {
print('Reloading...');
await prefs.reload();
}
}
Logs
C:\tmp\shared_prefs_example>flutter run --verbose
[ +88 ms] executing: [C:\dev\tools\flutter\flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[ +65 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[ ] 18116933e77adc82f80866c928266a5b4f1ed645
[ +1 ms] executing: [C:\dev\tools\flutter\flutter/] git tag --points-at 18116933e77adc82f80866c928266a5b4f1ed645
[ +68 ms] Exit code 0 from: git tag --points-at 18116933e77adc82f80866c928266a5b4f1ed645
[ ] 2.5.3
[ +8 ms] executing: [C:\dev\tools\flutter\flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[ +51 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[ ] origin/stable
[ ] executing: [C:\dev\tools\flutter\flutter/] git ls-remote --get-url origin
[ +32 ms] Exit code 0 from: git ls-remote --get-url origin
[ ] https://github.com/flutter/flutter.git
[ +116 ms] executing: [C:\dev\tools\flutter\flutter/] git rev-parse --abbrev-ref HEAD
[ +39 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[ ] stable
[ +87 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[ +6 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +65 ms] executing: C:\dev\tools\android\sdk\platform-tools\adb.exe devices -l
[ +50 ms] List of devices attached
EHT7N19311002718 device product:VOG-L29EEA model:VOG_L29 device:HWVOG transport_id:16
[ +11 ms] C:\dev\tools\android\sdk\platform-tools\adb.exe -s EHT7N19311002718 shell getprop
[ +73 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[ +3 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +84 ms] Skipping pub get: version match.
[ +30 ms] Found plugin path_provider_linux at C:\dev\tools\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\path_provider_linux-2.1.3\
[ +7 ms] Found plugin path_provider_windows at C:\dev\tools\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\path_provider_windows-2.0.4\
[ +6 ms] Found plugin shared_preferences at C:\dev\tools\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\shared_preferences-2.0.9\
[ +2 ms] Found plugin shared_preferences_android at C:\dev\tools\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\shared_preferences_android-2.0.9\
[ +3 ms] Found plugin shared_preferences_ios at C:\dev\tools\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\shared_preferences_ios-2.0.8\
[ +2 ms] Found plugin shared_preferences_linux at C:\dev\tools\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\shared_preferences_linux-2.0.3\
[ +1 ms] Found plugin shared_preferences_macos at C:\dev\tools\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\shared_preferences_macos-2.0.2\
[ +4 ms] Found plugin shared_preferences_web at C:\dev\tools\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\shared_preferences_web-2.0.2\
[ +1 ms] Found plugin shared_preferences_windows at C:\dev\tools\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\shared_preferences_windows-2.0.3\
[ +93 ms] Found plugin path_provider_linux at C:\dev\tools\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\path_provider_linux-2.1.3\
[ +3 ms] Found plugin path_provider_windows at C:\dev\tools\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\path_provider_windows-2.0.4\
[ +3 ms] Found plugin shared_preferences at C:\dev\tools\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\shared_preferences-2.0.9\
[ +1 ms] Found plugin shared_preferences_android at C:\dev\tools\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\shared_preferences_android-2.0.9\
[ +1 ms] Found plugin shared_preferences_ios at C:\dev\tools\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\shared_preferences_ios-2.0.8\
[ +1 ms] Found plugin shared_preferences_linux at C:\dev\tools\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\shared_preferences_linux-2.0.3\
[ +1 ms] Found plugin shared_preferences_macos at C:\dev\tools\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\shared_preferences_macos-2.0.2\
[ +2 ms] Found plugin shared_preferences_web at C:\dev\tools\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\shared_preferences_web-2.0.2\
[ +1 ms] Found plugin shared_preferences_windows at C:\dev\tools\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\shared_preferences_windows-2.0.3\
[ +18 ms] Generating C:\tmp\shared_prefs_example\android\app\src\main\java\io\flutter\plugins\GeneratedPluginRegistrant.java
[ +58 ms] ro.hardware = kirin980
[ ] ro.build.characteristics = default
[ +42 ms] Initializing file store
[ +10 ms] Skipping target: gen_localizations
[ +7 ms] Skipping target: gen_dart_plugin_registrant
[ +1 ms] Skipping target: _composite
[ +2 ms] complete
[ +5 ms] Launching lib\main.dart on VOG L29 in debug mode...
[ +5 ms] C:\dev\tools\flutter\flutter\bin\cache\dart-sdk\bin\dart.exe --disable-dart-dev C:\dev\tools\flutter\flutter\bin\cache\artifacts\engine\windows-x64\frontend_server.dart.snapshot --sdk-root C:\dev\tools\flutter\flutter\bin\cache\artifacts\engine\common\flutter_patched_sdk/ --incremental
--target=flutter --debugger-module-names --experimental-emit-debug-metadata -DFLUTTER_WEB_AUTO_DETECT=true --output-dill C:\Users\toreo\AppData\Local\Temp\flutter_tools.143c0a9a\flutter_tool.393c2678\app.dill --packages C:\tmp\shared_prefs_example\.dart_tool\package_config.json -Ddart.vm.profile=false
-Ddart.vm.product=false --enable-asserts --track-widget-creation --filesystem-scheme org-dartlang-root --initialize-from-dill build\c075001b96339384a97db4862b8ab8db.cache.dill.track.dill --enable-experiment=alternative-invalidation-strategy
[ +12 ms] executing: C:\dev\tools\android\sdk\build-tools\30.0.2\aapt dump xmltree C:\tmp\shared_prefs_example\build\app\outputs\flutter-apk\app.apk AndroidManifest.xml
[ +12 ms] Exit code 0 from: C:\dev\tools\android\sdk\build-tools\30.0.2\aapt dump xmltree C:\tmp\shared_prefs_example\build\app\outputs\flutter-apk\app.apk AndroidManifest.xml
[ ] N: android=http://schemas.android.com/apk/res/android
E: manifest (line=2)
A: android:versionCode(0x0101021b)=(type 0x10)0x1
A: android:versionName(0x0101021c)="1.0.0" (Raw: "1.0.0")
A: android:compileSdkVersion(0x01010572)=(type 0x10)0x1e
A: android:compileSdkVersionCodename(0x01010573)="11" (Raw: "11")
A: package="com.example.shared_prefs_example" (Raw: "com.example.shared_prefs_example")
A: platformBuildVersionCode=(type 0x10)0x1e
A: platformBuildVersionName=(type 0x10)0xb
E: uses-sdk (line=7)
A: android:minSdkVersion(0x0101020c)=(type 0x10)0x10
A: android:targetSdkVersion(0x01010270)=(type 0x10)0x1e
E: uses-permission (line=14)
A: android:name(0x01010003)="android.permission.INTERNET" (Raw: "android.permission.INTERNET")
E: application (line=16)
A: android:label(0x01010001)="shared_prefs_example" (Raw: "shared_prefs_example")
A: android:icon(0x01010002)=@0x7f080000
A: android:debuggable(0x0101000f)=(type 0x12)0xffffffff
A: android:appComponentFactory(0x0101057a)="androidx.core.app.CoreComponentFactory" (Raw: "androidx.core.app.CoreComponentFactory")
E: activity (line=21)
A: android:theme(0x01010000)=@0x7f0a0000
A: android:name(0x01010003)="com.example.shared_prefs_example.MainActivity" (Raw: "com.example.shared_prefs_example.MainActivity")
A: android:launchMode(0x0101001d)=(type 0x10)0x1
A: android:configChanges(0x0101001f)=(type 0x11)0x40003fb4
A: android:windowSoftInputMode(0x0101022b)=(type 0x11)0x10
A: android:hardwareAccelerated(0x010102d3)=(type 0x12)0xffffffff
E: meta-data (line=35)
A: android:name(0x01010003)="io.flutter.embedding.android.NormalTheme" (Raw: "io.flutter.embedding.android.NormalTheme")
A: android:resource(0x01010025)=@0x7f0a0001
E: meta-data (line=45)
A: android:name(0x01010003)="io.flutter.embedding.android.SplashScreenDrawable" (Raw: "io.flutter.embedding.android.SplashScreenDrawable")
A: android:resource(0x01010025)=@0x7f040000
E: intent-filter (line=49)
E: action (line=50)
A: android:name(0x01010003)="android.intent.action.MAIN" (Raw: "android.intent.action.MAIN")
E: category (line=52)
A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER")
E: meta-data (line=59)
A: android:name(0x01010003)="flutterEmbedding" (Raw: "flutterEmbedding")
A: android:value(0x01010024)=(type 0x10)0x2
[ +7 ms] executing: C:\dev\tools\android\sdk\platform-tools\adb.exe -s EHT7N19311002718 shell -x logcat -v time -t 1
[ +13 ms] <- compile package:shared_prefs_example/main.dart
[ +261 ms] --------- beginning of main
12-10 14:59:10.921 I/DownloadState( 2396): shareUid: 0 default_sk transmitting data speed : 21 bytes/s (rxB:107 txB:0 rxP:1 txP:0 iface:1) scroff: false
[ +11 ms] executing: C:\dev\tools\android\sdk\platform-tools\adb.exe version
[ +28 ms] Android Debug Bridge version 1.0.41
Version 31.0.3-7562133
Installed as C:\dev\tools\android\sdk\platform-tools\adb.exe
[ +2 ms] executing: C:\dev\tools\android\sdk\platform-tools\adb.exe start-server
[ +25 ms] Building APK
[ +26 ms] Running Gradle task 'assembleDebug'...
[ +5 ms] Using gradle from C:\tmp\shared_prefs_example\android\gradlew.bat.
[ +16 ms] executing: C:\dev\tools\android\studio\jre\bin\java -version
[ +167 ms] Exit code 0 from: C:\dev\tools\android\studio\jre\bin\java -version
[ ] openjdk version "11.0.10" 2021-01-19
OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
OpenJDK 64-Bit Server VM (build 11.0.10+0-b96-7249189, mixed mode)
[ +2 ms] executing: C:\dev\tools\android\studio\jre\bin\java -version
[ +150 ms] Exit code 0 from: C:\dev\tools\android\studio\jre\bin\java -version
[ ] openjdk version "11.0.10" 2021-01-19
OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
OpenJDK 64-Bit Server VM (build 11.0.10+0-b96-7249189, mixed mode)
[ +1 ms] executing: C:\dev\tools\android\studio\jre\bin\java -version
[ +158 ms] Exit code 0 from: C:\dev\tools\android\studio\jre\bin\java -version
[ ] openjdk version "11.0.10" 2021-01-19
OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
OpenJDK 64-Bit Server VM (build 11.0.10+0-b96-7249189, mixed mode)
[ +1 ms] executing: C:\dev\tools\android\studio\jre\bin\java -version
[ +157 ms] Exit code 0 from: C:\dev\tools\android\studio\jre\bin\java -version
[ ] openjdk version "11.0.10" 2021-01-19
OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
OpenJDK 64-Bit Server VM (build 11.0.10+0-b96-7249189, mixed mode)
[ +2 ms] executing: [C:\tmp\shared_prefs_example\android/] C:\tmp\shared_prefs_example\android\gradlew.bat -Pverbose=true -Ptarget-platform=android-arm64 -Ptarget=C:\tmp\shared_prefs_example\lib\main.dart -Pdart-defines=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ== -Pdart-obfuscation=false
-Ptrack-widget-creation=true -Ptree-shake-icons=false -Pfilesystem-scheme=org-dartlang-root assembleDebug
[+1988 ms] > Task :app:compileFlutterBuildDebug UP-TO-DATE
[ ] > Task :app:packLibsflutterBuildDebug UP-TO-DATE
[ ] > Task :app:preBuild UP-TO-DATE
[ ] > Task :app:preDebugBuild UP-TO-DATE
[ ] > Task :shared_preferences_android:preBuild UP-TO-DATE
[ ] > Task :shared_preferences_android:preDebugBuild UP-TO-DATE
[ +6 ms] > Task :shared_preferences_android:compileDebugAidl NO-SOURCE
[ +2 ms] > Task :app:compileDebugAidl NO-SOURCE
[ +2 ms] > Task :shared_preferences_android:packageDebugRenderscript NO-SOURCE
[ +2 ms] > Task :app:compileDebugRenderscript NO-SOURCE
[ +22 ms] > Task :app:generateDebugBuildConfig UP-TO-DATE
[ +5 ms] > Task :shared_preferences_android:writeDebugAarMetadata UP-TO-DATE
[ +1 ms] > Task :app:checkDebugAarMetadata UP-TO-DATE
[ +37 ms] > Task :app:cleanMergeDebugAssets
[ +1 ms] > Task :app:mergeDebugShaders UP-TO-DATE
[ ] > Task :app:compileDebugShaders NO-SOURCE
[ ] > Task :app:generateDebugAssets UP-TO-DATE
[ ] > Task :shared_preferences_android:mergeDebugShaders UP-TO-DATE
[ ] > Task :shared_preferences_android:compileDebugShaders NO-SOURCE
[ ] > Task :shared_preferences_android:generateDebugAssets UP-TO-DATE
[ ] > Task :shared_preferences_android:packageDebugAssets UP-TO-DATE
[ ] > Task :app:mergeDebugAssets
[ +409 ms] > Task :app:copyFlutterAssetsDebug
[ +4 ms] > Task :app:generateDebugResValues UP-TO-DATE
[ ] > Task :app:generateDebugResources UP-TO-DATE
[ ] > Task :shared_preferences_android:compileDebugRenderscript NO-SOURCE
[ +1 ms] > Task :shared_preferences_android:generateDebugResValues UP-TO-DATE
[ +1 ms] > Task :shared_preferences_android:generateDebugResources UP-TO-DATE
[ +7 ms] > Task :shared_preferences_android:packageDebugResources UP-TO-DATE
[ +1 ms] > Task :app:mergeDebugResources UP-TO-DATE
[ ] > Task :app:createDebugCompatibleScreenManifests UP-TO-DATE
[ ] > Task :app:extractDeepLinksDebug UP-TO-DATE
[ ] > Task :shared_preferences_android:extractDeepLinksDebug UP-TO-DATE
[ ] > Task :shared_preferences_android:processDebugManifest UP-TO-DATE
[ +115 ms] > Task :app:processDebugMainManifest UP-TO-DATE
[ +1 ms] > Task :app:processDebugManifest UP-TO-DATE
[ ] > Task :app:processDebugManifestForPackage UP-TO-DATE
[ ] > Task :shared_preferences_android:compileDebugLibraryResources UP-TO-DATE
[ +5 ms] > Task :shared_preferences_android:parseDebugLocalResources UP-TO-DATE
[ +1 ms] > Task :shared_preferences_android:generateDebugRFile UP-TO-DATE
[ +1 ms] > Task :app:processDebugResources UP-TO-DATE
[ ] > Task :shared_preferences_android:generateDebugBuildConfig UP-TO-DATE
[ ] > Task :shared_preferences_android:javaPreCompileDebug UP-TO-DATE
[ +37 ms] > Task :shared_preferences_android:compileDebugJavaWithJavac UP-TO-DATE
[ +2 ms] > Task :shared_preferences_android:bundleLibCompileToJarDebug UP-TO-DATE
[ +2 ms] > Task :app:compileDebugKotlin UP-TO-DATE
[ +2 ms] > Task :app:javaPreCompileDebug UP-TO-DATE
[ ] > Task :app:compileDebugJavaWithJavac UP-TO-DATE
[ +2 ms] > Task :app:compileDebugSources UP-TO-DATE
[ +8 ms] > Task :app:mergeDebugNativeDebugMetadata NO-SOURCE
[ +1 ms] > Task :app:compressDebugAssets UP-TO-DATE
[ ] > Task :app:processDebugJavaRes NO-SOURCE
[ ] > Task :shared_preferences_android:processDebugJavaRes NO-SOURCE
[ ] > Task :shared_preferences_android:bundleLibResDebug NO-SOURCE
[ +95 ms] > Task :app:mergeDebugJavaResource UP-TO-DATE
[ +1 ms] > Task :shared_preferences_android:bundleLibRuntimeToJarDebug UP-TO-DATE
[ ] > Task :app:checkDebugDuplicateClasses UP-TO-DATE
[ ] > Task :app:dexBuilderDebug UP-TO-DATE
[ ] > Task :app:desugarDebugFileDependencies UP-TO-DATE
[ ] > Task :app:mergeExtDexDebug UP-TO-DATE
[ ] > Task :app:mergeDexDebug UP-TO-DATE
[ ] > Task :app:mergeDebugJniLibFolders UP-TO-DATE
[ ] > Task :shared_preferences_android:mergeDebugJniLibFolders UP-TO-DATE
[ ] > Task :shared_preferences_android:mergeDebugNativeLibs NO-SOURCE
[ ] > Task :shared_preferences_android:stripDebugDebugSymbols NO-SOURCE
[ ] > Task :shared_preferences_android:copyDebugJniLibsProjectOnly UP-TO-DATE
[ +1 ms] > Task :app:mergeDebugNativeLibs UP-TO-DATE
[ ] > Task :app:stripDebugDebugSymbols UP-TO-DATE
[ ] > Task :app:validateSigningDebug UP-TO-DATE
[ +71 ms] > Task :app:packageDebug UP-TO-DATE
[ +205 ms] > Task :app:assembleDebug
[ +1 ms] > Task :shared_preferences_android:copyDebugJniLibsProjectAndLocalJars UP-TO-DATE
[ ] > Task :shared_preferences_android:extractDebugAnnotations UP-TO-DATE
[ ] > Task :shared_preferences_android:mergeDebugGeneratedProguardFiles UP-TO-DATE
[ ] > Task :shared_preferences_android:mergeDebugConsumerProguardFiles UP-TO-DATE
[ ] > Task :shared_preferences_android:prepareLintJarForPublish UP-TO-DATE
[ ] > Task :shared_preferences_android:mergeDebugJavaResource UP-TO-DATE
[ ] > Task :shared_preferences_android:syncDebugLibJars UP-TO-DATE
[ ] > Task :shared_preferences_android:bundleDebugAar UP-TO-DATE
[ ] > Task :shared_preferences_android:mergeDebugResources UP-TO-DATE
[ +1 ms] > Task :shared_preferences_android:compileDebugSources UP-TO-DATE
[ +1 ms] > Task :shared_preferences_android:assembleDebug UP-TO-DATE
[ +12 ms] Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
[ ] Use '--warning-mode all' to show the individual deprecation warnings.
[ ] See https://docs.gradle.org/6.7/userguide/command_line_interface.html#sec:command_line_warnings
[ +1 ms] BUILD SUCCESSFUL in 2s
[ ] 58 actionable tasks: 4 executed, 54 up-to-date
[ +557 ms] Running Gradle task 'assembleDebug'... (completed in 4,3s)
[ +72 ms] calculateSha: LocalDirectory: 'C:\tmp\shared_prefs_example\build\app\outputs\flutter-apk'/app.apk
[ +863 ms] √ Built build\app\outputs\flutter-apk\app-debug.apk.
[ +3 ms] executing: C:\dev\tools\android\sdk\build-tools\30.0.2\aapt dump xmltree C:\tmp\shared_prefs_example\build\app\outputs\flutter-apk\app.apk AndroidManifest.xml
[ +15 ms] Exit code 0 from: C:\dev\tools\android\sdk\build-tools\30.0.2\aapt dump xmltree C:\tmp\shared_prefs_example\build\app\outputs\flutter-apk\app.apk AndroidManifest.xml
[ ] N: android=http://schemas.android.com/apk/res/android
E: manifest (line=2)
A: android:versionCode(0x0101021b)=(type 0x10)0x1
A: android:versionName(0x0101021c)="1.0.0" (Raw: "1.0.0")
A: android:compileSdkVersion(0x01010572)=(type 0x10)0x1e
A: android:compileSdkVersionCodename(0x01010573)="11" (Raw: "11")
A: package="com.example.shared_prefs_example" (Raw: "com.example.shared_prefs_example")
A: platformBuildVersionCode=(type 0x10)0x1e
A: platformBuildVersionName=(type 0x10)0xb
E: uses-sdk (line=7)
A: android:minSdkVersion(0x0101020c)=(type 0x10)0x10
A: android:targetSdkVersion(0x01010270)=(type 0x10)0x1e
E: uses-permission (line=14)
A: android:name(0x01010003)="android.permission.INTERNET" (Raw: "android.permission.INTERNET")
E: application (line=16)
A: android:label(0x01010001)="shared_prefs_example" (Raw: "shared_prefs_example")
A: android:icon(0x01010002)=@0x7f080000
A: android:debuggable(0x0101000f)=(type 0x12)0xffffffff
A: android:appComponentFactory(0x0101057a)="androidx.core.app.CoreComponentFactory" (Raw: "androidx.core.app.CoreComponentFactory")
E: activity (line=21)
A: android:theme(0x01010000)=@0x7f0a0000
A: android:name(0x01010003)="com.example.shared_prefs_example.MainActivity" (Raw: "com.example.shared_prefs_example.MainActivity")
A: android:launchMode(0x0101001d)=(type 0x10)0x1
A: android:configChanges(0x0101001f)=(type 0x11)0x40003fb4
A: android:windowSoftInputMode(0x0101022b)=(type 0x11)0x10
A: android:hardwareAccelerated(0x010102d3)=(type 0x12)0xffffffff
E: meta-data (line=35)
A: android:name(0x01010003)="io.flutter.embedding.android.NormalTheme" (Raw: "io.flutter.embedding.android.NormalTheme")
A: android:resource(0x01010025)=@0x7f0a0001
E: meta-data (line=45)
A: android:name(0x01010003)="io.flutter.embedding.android.SplashScreenDrawable" (Raw: "io.flutter.embedding.android.SplashScreenDrawable")
A: android:resource(0x01010025)=@0x7f040000
E: intent-filter (line=49)
E: action (line=50)
A: android:name(0x01010003)="android.intent.action.MAIN" (Raw: "android.intent.action.MAIN")
E: category (line=52)
A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER")
E: meta-data (line=59)
A: android:name(0x01010003)="flutterEmbedding" (Raw: "flutterEmbedding")
A: android:value(0x01010024)=(type 0x10)0x2
[ +3 ms] Stopping app 'app.apk' on VOG L29.
[ +1 ms] executing: C:\dev\tools\android\sdk\platform-tools\adb.exe -s EHT7N19311002718 shell am force-stop com.example.shared_prefs_example
[ +77 ms] executing: C:\dev\tools\android\sdk\platform-tools\adb.exe -s EHT7N19311002718 shell pm list packages com.example.shared_prefs_example
[ +73 ms] package:com.example.shared_prefs_example
[ +3 ms] executing: C:\dev\tools\android\sdk\platform-tools\adb.exe -s EHT7N19311002718 shell cat /data/local/tmp/sky.com.example.shared_prefs_example.sha1
[ +62 ms] f551dc26522847b84dbe4b8550ab70d49c61fe65
[ +1 ms] Latest build already installed.
[ ] executing: C:\dev\tools\android\sdk\platform-tools\adb.exe -s EHT7N19311002718 shell -x logcat -v time -t 1
[ +249 ms] --------- beginning of main
12-10 14:59:16.782 I/PackageManager( 1231): getInstalledPackages cost 1 ms, flags: 786432, userId: 0, callingUid: 2000, callingPid: 19176
[ +17 ms] executing: C:\dev\tools\android\sdk\platform-tools\adb.exe -s EHT7N19311002718 shell am start -a android.intent.action.RUN -f 0x20000000 --ez enable-background-compilation true --ez enable-dart-profiling true --ez enable-checked-mode true --ez verify-entry-points true
com.example.shared_prefs_example/com.example.shared_prefs_example.MainActivity
[ +105 ms] Starting: Intent { act=android.intent.action.RUN flg=0x20000000 cmp=com.example.shared_prefs_example/.MainActivity (has extras) }
[ +1 ms] Waiting for observatory port to be available...
[ +216 ms] W/FlutterActivityAndFragmentDelegate(19196): A splash screen was provided to Flutter, but this is deprecated. See flutter.dev/go/android-splash-migration for migration steps.
[ +86 ms] Observatory URL on device: http://127.0.0.1:46667/Ihdzvr-WYzo=/
[ +5 ms] executing: C:\dev\tools\android\sdk\platform-tools\adb.exe -s EHT7N19311002718 forward tcp:0 tcp:46667
[ +48 ms] 51378
[ +1 ms] Forwarded host port 51378 to device port 46667 for Observatory
[ +6 ms] Caching compiled dill
[ +30 ms] Connecting to service protocol: http://127.0.0.1:51378/Ihdzvr-WYzo=/
[ +186 ms] Launching a Dart Developer Service (DDS) instance at http://127.0.0.1:0, connecting to VM service at http://127.0.0.1:51378/Ihdzvr-WYzo=/.
[ +181 ms] DDS is listening at http://127.0.0.1:51381/EoWF5Qhe0VI=/.
[ +53 ms] Successfully connected to service protocol: http://127.0.0.1:51378/Ihdzvr-WYzo=/
[ +57 ms] DevFS: Creating new filesystem on the device (null)
[ +21 ms] DevFS: Created new filesystem on the device (file:///data/user/0/com.example.shared_prefs_example/code_cache/shared_prefs_exampleUNMJGS/shared_prefs_example/)
[ +3 ms] Updating assets
[ +112 ms] Syncing files to device VOG L29...
[ +3 ms] <- reset
[ ] Compiling dart to kernel with 0 updated files
[ +2 ms] <- recompile package:shared_prefs_example/main.dart e7c54cd8-dd56-4217-8d77-489cec2b48d5
[ ] <- e7c54cd8-dd56-4217-8d77-489cec2b48d5
[ +152 ms] Updating files.
[ +3 ms] DevFS: Sync finished
[ +1 ms] Syncing files to device VOG L29... (completed in 163ms)
[ +1 ms] Synced 0.0MB.
[ +2 ms] <- accept
[ +4 ms] Connected to _flutterView/0x7d0f54fe20.
[ +3 ms] Flutter run key commands.
[ +2 ms] r Hot reload.
[ ] R Hot restart.
[ +1 ms] h List all available interactive commands.
[ +2 ms] d Detach (terminate "flutter run" but leave application running).
[ ] c Clear the screen
[ ] q Quit (terminate the application on the device).
[ ] Running with sound null safety
[ ] An Observatory debugger and profiler on VOG L29 is available at: http://127.0.0.1:51381/EoWF5Qhe0VI=/
[ +103 ms] DevTools activation throttled until 2021-12-11 00:33:44.242587.
[ +538 ms] The Flutter DevTools debugger and profiler on VOG L29 is available at: http://127.0.0.1:9105?uri=http://127.0.0.1:51381/EoWF5Qhe0VI=/
[+3296 ms] I/AwareBitmapCacher(19196): init lrucache size: 2097152 pid=19196
[ +882 ms] W/Settings(19196): Setting device_provisioned has moved from android.provider.Settings.Secure to android.provider.Settings.Global.
[ +4 ms] V/HiTouch_HiTouchSensor(19196): User setup is finished.
[ +137 ms] V/AudioManager(19196): querySoundEffectsEnabled...
[ +8 ms] I/flutter (19196):
[ +2 ms] I/flutter (19196):
[ +133 ms] I/flutter (19196): Setting key my_test_key with value gold
[ +6 ms] I/flutter (19196): Reloading...
[ +20 ms] I/flutter (19196): Reading after 10ms key my_test_key : gold
[ +82 ms] I/flutter (19196): Reloading after 100ms key my_test_key : gold
[ +729 ms] V/AudioManager(19196): querySoundEffectsEnabled...
[ +1 ms] I/flutter (19196):
[ ] I/flutter (19196):
[ +108 ms] I/flutter (19196): Setting key my_test_key with value gold
[ +5 ms] I/flutter (19196): Reloading...
[ +23 ms] I/flutter (19196): Reading after 10ms key my_test_key : gold
[ +81 ms] I/flutter (19196): Reloading after 100ms key my_test_key : gold
[ +491 ms] I/flutter (19196):
[ +4 ms] I/flutter (19196):
[ +2 ms] V/AudioManager(19196): querySoundEffectsEnabled...
[ +103 ms] I/flutter (19196): Setting key my_test_key with value gold
[ +4 ms] I/flutter (19196): Reloading...
[ +17 ms] I/flutter (19196): Reading after 10ms key my_test_key : gold
[ +84 ms] I/flutter (19196): Reloading after 100ms key my_test_key : gold
[ +521 ms] I/flutter (19196):
[ +5 ms] I/flutter (19196):
[ +5 ms] V/AudioManager(19196): querySoundEffectsEnabled...
[ +98 ms] I/flutter (19196): Setting key my_test_key with value gold
[ +5 ms] I/flutter (19196): Reloading...
[ +29 ms] I/flutter (19196): Reading after 10ms key my_test_key : null
[ +74 ms] I/flutter (19196): Reloading after 100ms key my_test_key : gold
[ +520 ms] V/AudioManager(19196): querySoundEffectsEnabled...
[ +5 ms] I/flutter (19196):
[ +3 ms] I/flutter (19196):
[ +101 ms] I/flutter (19196): Setting key my_test_key with value gold
[ +1 ms] I/flutter (19196): Reloading...
[ +17 ms] I/flutter (19196): Reading after 10ms key my_test_key : null
[ +87 ms] I/flutter (19196): Reloading after 100ms key my_test_key : gold
[ +876 ms] I/flutter (19196):
[ +4 ms] I/flutter (19196):
C:\tmp\shared_prefs_example>flutter analyze
Analyzing shared_prefs_example...
info - Prefer const over final for declarations - lib\main.dart:69:5 - prefer_const_declarations
info - Avoid `print` calls in production code - lib\main.dart:70:5 - avoid_print
info - Avoid `print` calls in production code - lib\main.dart:79:5 - avoid_print
info - Avoid `print` calls in production code - lib\main.dart:83:5 - avoid_print
info - Avoid `print` calls in production code - lib\main.dart:86:5 - avoid_print
info - Avoid `print` calls in production code - lib\main.dart:90:5 - avoid_print
6 issues found. (ran in 8.4s)
C:\tmp\shared_prefs_example>
C:\tmp\shared_prefs_example>flutter doctor -v
[√] Flutter (Channel stable, 2.5.3, on Microsoft Windows [Version 10.0.19043.1348], locale nb-NO)
• Flutter version 2.5.3 at C:\dev\tools\flutter\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 18116933e7 (8 weeks ago), 2021-10-15 10:46:35 -0700
• Engine revision d3ea636dc5
• Dart version 2.14.4
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at C:\dev\tools\android\sdk
• Platform android-31, build-tools 30.0.2
• ANDROID_HOME = C:\dev\tools\android\sdk
• Java binary at: C:\dev\tools\android\studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[√] Android Studio (version 2020.3)
• Android Studio at C:\dev\tools\android\studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
[√] IntelliJ IDEA Community Edition (version 2017.2)
• IntelliJ at C:\dev\tools\intellij\IntelliJ IDEA Community Edition 2017.2.6
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
[√] IntelliJ IDEA Community Edition (version 2017.3)
• IntelliJ at C:\dev\tools\intellij\IntelliJ IDEA Community Edition 2017.3.2
• Flutter plugin version 24.1.1
• Dart plugin version 173.4700
[√] IntelliJ IDEA Community Edition (version 2020.2)
• IntelliJ at C:\dev\tools\intellij\IntelliJ IDEA Community Edition 2019.1.1
• Flutter plugin version 54.0.2
• Dart plugin version 202.8443
[√] Connected device (3 available)
• VOG L29 (mobile) • EHT7N19311002718 • android-arm64 • Android 10 (API 29)
• Chrome (web) • chrome • web-javascript • Google Chrome 96.0.4664.45
• Edge (web) • edge • web-javascript • Microsoft Edge 96.0.1054.43
• No issues found!
C:\tmp\shared_prefs_example>