两个地方同时调用导致_spf为null而取不到值

This commit is contained in:
Tom Xu
2019-09-28 04:08:50 +08:00
committed by GitHub
parent 3570be0c71
commit 14749573d5

View File

@ -24,8 +24,9 @@ class SpUtil {
static Future<SpUtil> getInstance() async { static Future<SpUtil> getInstance() async {
if (_instance == null) { if (_instance == null) {
_instance = new SpUtil._(); _instance = new SpUtil._();
}
if (_spf == null) {
await _instance._init(); await _instance._init();
} }
return _instance; return _instance;
} }
@ -117,4 +118,4 @@ class SpUtil {
if (_beforeCheck()) return null; if (_beforeCheck()) return null;
return _spf.clear(); return _spf.clear();
} }
} }