readAll method

  1. @override
Future<Map<String, String>> readAll()

Reads and returns all key-value pairs from storage.

Only string values are included. Keys with non-string values are ignored.

Implementation

@override
Future<Map<String, String>> readAll() async {
  if (_needsInit) await _initPrefs();
  final result = <String, String>{};
  for (final k in _prefs!.keys) {
    try {
      final v = _prefs!.getString(k);
      if (v != null) result[k] = v;
    } on Object catch (_) {}
  }
  return result;
}