needUpdate method

  1. @override
Future<bool> needUpdate({
  1. required bool forceNoCache,
  2. String? storeVersion,
})
override

Implementation

@override
Future<bool> needUpdate(
    {required bool forceNoCache, String? storeVersion}) async {
  try {
    final info = await InAppUpdate.checkForUpdate();
    if (info.updateAvailability != UpdateAvailability.updateAvailable) {
      return false;
    }
    if (!info.flexibleUpdateAllowed) return false;
    return info.updateAvailability == UpdateAvailability.updateAvailable;
  } on MissingPluginException catch (_) {
    debugPrint('[🔄 Update] Installed not from Google Play');
    return false;
  } on Exception catch (e) {
    debugPrint('[🔄 Update: needUpdate] err: ${e.toString()}');
    return false;
  }
}