checkAppVersion method

  1. @override
Future<void> checkAppVersion(
  1. String appVersion
)
override

Checks the app version and clears cache if it's outdated.

Implementation

@override
Future<void> checkAppVersion(String appVersion) async {
  final storedVersion = window.sessionStorage.getItem(getCacheKey());

  if (storedVersion != appVersion) {
    await clearCache();
    window.sessionStorage.setItem(getCacheKey(), appVersion);
    // Only reload if there was a different version before, not on first load.
    if (storedVersion != null) {
      window.location.reload();
    }
  }
}