load method

Future<List<WidgetEntry>?> load(
  1. String key
)

Returns the cached widget list for key, or null if nothing is stored or the stored data cannot be parsed.

Implementation

Future<List<WidgetEntry>?> load(String key) async {
  final prefs = await SharedPreferences.getInstance();
  final raw = prefs.getString('$_prefix$key');
  if (raw == null) return null;
  try {
    final data = json.decode(raw) as Map<String, dynamic>;
    return WidgetResponse.fromJson(data).widgets;
  } catch (_) {
    return null;
  }
}