getData<T> static method

Future<T?> getData<T>({
  1. required String key,
})

Get the stored data with key.

Implementation

static Future<T?> getData<T>({required String key}) async {
  final prefs = await SharedPreferences.getInstance();
  await prefs.reload();
  final prefsKey = _kPrefsKeyPrefix + key;
  final value = prefs.get(prefsKey);

  return (value is T) ? value : null;
}