Upgrader: A Flutter Package for Prompting App Upgrades

Published on by Flutter News Hub

Upgrader: A Flutter Package for Prompting App Upgrades

Upgrader is a Flutter package that allows developers to easily prompt users to upgrade their app when a newer version is available in the app store. It features simple alert or card widgets that display the necessary information and provide upgrade options.

Key Features

  • Automatic Version Checking: Upgrader seamlessly checks for app updates on Android and iOS platforms.
  • Customizable Widgets: Choose between alert or card widgets and tailor the appearance and behavior to match your app's design.
  • Internationalization: Upgrader supports a range of languages for display text, allowing for global app distribution.
  • Release Notes Display: Display release notes for the new version to provide users with more context about the update.
  • Multiple Button Options: Configure upgrade prompts with Ignore, Later, and Update Now buttons to provide users with choices.

Widget Examples

Alert Widget:

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

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

Card Widget:

return Container(
  margin: EdgeInsets.fromLTRB(12.0, 0.0, 12.0, 0.0),
  child: UpgradeCard(),
);

Customization

Upgrader offers extensive customization options through parameters in the constructor:

  • dialogStyle: Specify the upgrade dialog style as material (default) or cupertino.
  • onIgnore: Callback for when the Ignore button is tapped.
  • onLater: Callback for when the Later button is tapped.
  • onUpdate: Callback for when the Update Now button is tapped.
  • shouldPopScope: Determines if the dialog blocks the current route from being popped.
  • showIgnore: Hide or show the Ignore button.
  • showLater: Hide or show the Later button.
  • showReleaseNotes: Hide or show release notes.

Appcast Support

Upgrader supports Appcast, an RSS feed format used to provide app version information. This allows for centralized management of app updates and real-time availability of the latest version.

Example:

final upgrader = Upgrader(
  storeController: UpgraderStoreController(
    onAndroid: () => UpgraderPlayStore(),
    oniOS: () => UpgraderAppcastStore(appcastURL: appcastURL),
  ),
);

Language Localization

Upgrader supports localization for over 30 languages, including Spanish, French, German, and more. Developers can also provide custom localization through the messages parameter:

UpgradeAlert(
  upgrader: Upgrader(
    messages: MyUpgraderMessages(),
  ),
);

Conclusion

Upgrader is a robust and customizable solution for prompting app upgrades in Flutter applications. Its intuitive widgets, platform support, and extensive customization options make it an essential tool for app developers. By leveraging Upgrader, you can seamlessly inform users about new app versions, encourage timely updates, and provide a smooth user experience.

Flutter News Hub