-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Describe the bug
null exception when calling getKey
E/flutter ( 4581): [ERROR:flutter/shell/common/shell.cc(184)] Dart Error: Unhandled exception:
E/flutter ( 4581): NoSuchMethodError: The method 'getStringList' was called on null.
E/flutter ( 4581): Receiver: null
To Reproduce
Steps to reproduce the behavior:
var cache = new CsCache();
cache.getKey("key");
Expected behavior
Able to call getKey without exception
Desktop (please complete the following information):
- OS: Mint19
- Version of this package: ^1.0.0
Smartphone (please complete the following information):
- Device: Android emulator Pixel XL API 28, Android 9.0 (with Google APIs) x86
Additional context
I guess the getKey was called before the async _setSharedPref finished.
factory CsCache() {
......
_singltonInstance._setSharedPref();
......
}
void _setSharedPref() async {
_sharedPreferences = await SharedPreferences.getInstance();
}
BTW, using Flutter 1.0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels