getData<T> method
Null safety
- String key
Implementation
Future<T> getData<T>(String key) async {
// Get SharedPreferences ref
final SharedPreferences ref = await preferences;
// Get data by key with cast to output data type
return ref.get(key) as T;
}