reload method Null safety

Future<void> reload()

Fetches the latest values from the host platform.

Use this method to observe modifications that were made in native code (without using the plugin) while the app is running.

Implementation

Future<void> reload() async {
  final Map<String, Object> preferences =
      await SharedPreferences._getSharedPreferencesMap();
  _preferenceCache.clear();
  _preferenceCache.addAll(preferences);
}