larryaasen / upgrader

A Flutter package for prompting users to upgrade when there is a newer version of the app in the store.
MIT License
558 stars 271 forks source link

How to check if there is an update version or not #349

Open mariam-wahba opened 11 months ago

mariam-wahba commented 11 months ago

while using upgrader 8.2.0 and i saw the example it is not enough to understand How to check if there is an update version or not and if there is i hot can fire the alert pop up and direct to either app store or play store

larryaasen commented 11 months ago

The package will display the alert automatically when an update is detected. You can try this parameter: willDisplayUpgrade: called when upgrader determines that an upgrade may or may not be displayed.

mariam-wahba commented 11 months ago

hello @larryaasen , this what is written in the documentaion of this plugin

/*

import 'package:flutter/material.dart'; import 'package:upgrader/upgrader.dart';

void main() async { WidgetsFlutterBinding.ensureInitialized();

// Only call clearSavedSettings() during testing to reset internal values. await Upgrader.clearSavedSettings(); // REMOVE this for release builds

// On Android, the default behavior will be to use the Google Play Store // version of the app. // On iOS, the default behavior will be to use the App Store version of // the app, so update the Bundle Identifier in example/ios/Runner with a // valid identifier already in the App Store. runApp(MyApp()); }

class MyApp extends StatelessWidget { const MyApp({super.key});

@override Widget build(BuildContext context) { return MaterialApp( title: 'Upgrader Example', home: UpgradeAlert( child: Scaffold( appBar: AppBar(title: Text('Upgrader Example')), body: Center(child: Text('Checking...')), )), ); } }

i'm lost. i don't know what to write exactly so that the alert dialog pops ap and redirect me when pressing on update button to either to its' link on apple store and to it's link on play store like https://play.google.com/store/apps/details?id=com.xxxxxx.xxxxx and https://apps.apple.com/eg/app/xxxxxxx/idxxxxxx