getInstance static method

Future<SharedPreferences> getInstance()

Gets the SharedPreferences instance, initializing it if necessary.

This is the primary method for obtaining the SharedPreferences instance throughout the application.

Returns a Future that completes with the SharedPreferences instance.

Implementation

static Future<SharedPreferences> getInstance() async {
  return _prefs ?? await _init();
}