This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:shared_preferences/shared_preferences.dart'; | |
class PreferenceUtils { | |
static Future<SharedPreferences> get _instance async => | |
_prefsInstance ??= await SharedPreferences.getInstance(); | |
static SharedPreferences _prefsInstance; | |
/// Call this method from iniState() function of mainApp() fo create instance [PreferenceUtils] | |
static Future<SharedPreferences> init() async { | |
_prefsInstance = await _instance; |