upgrader 0.10.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 90

Upgrader #

Flutter package for prompting users to upgrade when there is a newer version of the app in the store.

Build Status CircleCI codecov pub package

Become a Patron!

When a newer app version is availabe in the app store, a simple alert prompt widget or card is displayed. With today's modern app stores, there is little need to persuade users to upgrade because most of them are already using the auto upgrade feature. However, there may be times when an app needs to be updated more quickly than usual, and nagging a user to upgrade will entice the upgrade sooner. Also, with Flutter supporting more than just Android and iOS app stores in the future, it will become more likely that users on other app stores need to be nagged about upgrading.

The UI comes in two flavors: alert or card. The UpgradeAlert class is used to display the popup alert prompt, and the UpgradeCard class is used to display the inline material design card.

Alert Example #

Just wrap your body widget in the UpgradeAlert widget, and it will handle the rest.

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

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
    Key key,
  }) : super(key: key);

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

Screenshot of alert #


Card Example #

Just return an UpgradeCard widget in your build method and a material design card will be displayed when an update is detected. The widget will have width and height of 0.0 when no update is detected.

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

Screenshot of card #


Customization #

The UpgradeAlert widget can be customized by setting parameters in the constructor of the UpgradeAlert widget.

  • appcastConfig: the appcast configuration, defaults to null
  • buttonTitleIgnore: the ignore button title, which defaults to Ignore
  • buttonTitleLater: the later button title, which defaults to Later
  • buttonTitleUpdate: the update button title, which defaults to Update Now
  • client: an HTTP Client that can be replaced for mock testing, defaults to null
  • daysUntilAlertAgain: days until alerting user again, which defaults to 3
  • debugDisplayAlways: always force the upgrade to be available, defaults to false
  • debugDisplayOnce: display the upgrade at least once once, defaults to false
  • debugLogging: display logging statements, which defaults to false
  • onIgnore: Called when the ignore button is tapped, defaults to null
  • onLater: Called when the later button is tapped, defaults to null
  • onUpdate: Called when the update button is tapped, defaults to null
  • prompt: the call to action message, which defaults to Would you like to update it now?
  • title: the alert dialog title, which defaults to Update App?
  • showIgnore: hide or show Ignore button on dialog, which defaults to true
  • showLater: hide or show Later button on dialog, which defaults to true
  • canDismissDialog: can alert dialog be dismissed on tap outside of the alert dialog, which defaults to false (not used by alert card)

Limitations #

These widgets work on both Android and iOS. When running on iOS the App Store will provide the latest app version and will display the prompt at the appropriate times.

On Android, this widget does nothing as there is no easy way to query the Google Play Store for metadata about an app. Without the metadata, the widget cannot compare the app version with the latest Play Store version. It will not disrupt the widget tree and can be included in an Android without any issues.

There is now an appcast that can be used for Android and iOS to remotely configure the latest app version.

Appcast #

The class Appcast, in this Flutter package, is used by the Upgrader widgets to download app details from an appcast, based on the Sparkle framework by Andy Matuschak. You can read the Sparkle documentation here: https://sparkle-project.org/documentation/publishing/.

An appcast is an RSS feed with one channel that has a collection of items that each describe one app version. The appcast will decscribe each app version and will provide the latest app version to Upgrader that indicates when an upgrade should be recommended.

The appcast must be hosted on a server that can be reached by everyone from the app. The appcast XML file can be autogenerated during the release process, or just manually updated after a release is available on the app store.

The Appcast class can be used stand alone or as part of Upgrader.

Appcast Example #

final appcast = Appcast();
final items = await appcast.parseAppcastItemsFromUri('https://raw.githubusercontent.com/larryaasen/upgrader/master/test/testappcast.xml');
final bestItem = appcast.bestItem();

Appcast Sample File #

<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle">
        <title>Debt Now App - Appcast</title>
            <title>Version 1.15.0</title>
            <pubDate>Sun, 30 Dec 2018 12:00:00 +0000</pubDate>
            <enclosure url="https://play.google.com/store/apps/details?id=com.moonwink.treasury" sparkle:version="1.15.0" sparkle:os="android" />

iTunes Search API #

There is a class in this Flutter package used by the upgrader widgets to download app details from the iTunes Search API. The class ITunesSearchAPI can be used standalone to query iTunes for app details.

ITunesSearchAPI Example #

final iTunes = ITunesSearchAPI();
final resultsFuture = iTunes.lookupByBundleId('com.google.Maps');
resultsFuture.then((results) {
    print('results: $results');

Results #


Command Line App #

There is a command line app used to display the results from iTunes Search. The code is located in bin/itunes_lookup.dart, and can be run from the command line like this:

$ dart itunes_lookup.dart bundleid=com.google.Maps


upgrader: download: https://itunes.apple.com/lookup?bundleId=com.google.Maps
upgrader: response statusCode: 200
itunes_lookup bundleId: com.google.Maps
itunes_lookup trackViewUrl: https://apps.apple.com/us/app/google-maps-transit-food/id585027354?uo=4
itunes_lookup version: 5.31
itunes_lookup all results:
{resultCount: 1, results: 

Contributing #

All comments and pull requests are welcome.

Become a Patron!

0.10.2 #

  • Prepare for 1.0.0 version of sensors and package_info. (dart_lsc)

0.10.1 #

  • Downgraded Flutter to stable channel on Travis CI and CircleCI builds to align with pub.dev health scoring.
  • Removed the use of TargetPlatform.macOS since it is only available on Flutter 1.13.0 and above.

0.10.0 #

  • Added options to hide ignore and later buttons. (Thanks to Karthik Ponnam)

  • Added option to close alert dialog on tap outside of alert dialog. (Thanks to Karthik Ponnam)

0.9.0 #

  • Added minimum support for Flutter at version 1.30.0 and above to support TargetPlatform.macOS.

0.8.1 #

  • Removed TargetPlatform.macOS since pub.dev does not support it yet.

0.8.0 #

  • Added support to ITunesSearchAPI for the country query string parameter. Improved example, and added a few new iTunes tests. Minor updates based on Health suggestions from pub.dev, utilizing pedantic.

0.7.0 #

  • Improved error messaging, allowed Appcast OS name (sparkle:os) to be case insensitive, example defaults to debug logging on, and added command line app to evaluate the iTunes search.

0.6.0 #

  • Fixed issue to not use the OS version string (deviceInfo.androidInfo.version.baseOS) when it is not a valid Semantic Version as defined here http://semver.org/.

0.5.1+1 #

  • updated the examples with an Appcast for Android.

0.5.1 #

  • downgraded the xml package version to 3.4.0 to be compatible with Dart 2.2, and updated the Dart version to 2.2.0

0.5.0 #

  • Breaking change. Migrate from the deprecated original Android Support Library to AndroidX. This shouldn't result in any functional changes, but it requires any Android apps using this plugin to also migrate if they're using the original support library.

0.4.3 #

  • improved README documentation and example code

0.4.2 #

  • fixed README file that appears on the Dart Packages website

0.4.1 #

  • fixed README file that appears on the Dart Packages website

0.4.0 #

  • added Appcast to support Android upgrades

0.3.0 #

  • added UpgradeCard class

0.2.0 #

  • added many customizations to the widget including callbacks for onIgnore, onLater, and onUpdate
  • updated the README screenshot
  • updated tests, improved README
  • broke out widget into new file

0.1.0 #

  • Initial Open Source release.


 * Copyright (c) 2019 Larry Aasen. All rights reserved.

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

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
    Key key,
  }) : super(key: key);

  Widget build(BuildContext context) {

    // On Android, setup the Appcast.
    // 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.
    final appcastURL =
    final cfg = AppcastConfiguration(url: appcastURL, supportedOS: ['android']);

    return MaterialApp(
      title: 'Upgrader Example',
      home: Scaffold(
          appBar: AppBar(
            title: Text('Upgrader Example'),
          body: UpgradeAlert(
            appcastConfig: cfg,
            debugLogging: true,
            child: Center(child: Text('Checking...')),

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  upgrader: ^0.10.2

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:upgrader/upgrader.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Apr 7, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Maintenance issues and suggestions

Support latest dependencies. (-20 points)

The version constraint in pubspec.yaml does not support the latest published versions for 2 dependencies (flutter_device_locale, xml).


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.2 <3.0.0
device_info ^0.4.0+1 0.4.2+1
flutter 0.0.0
flutter_device_locale ^0.3.4+1 0.3.4+1 0.4.0
http ^0.12.0 0.12.0+4
package_info >=0.4.0+3 <2.0.0 0.4.0+16
shared_preferences ^0.5.2 0.5.6+3
url_launcher ^5.0.2 5.4.2
version ^1.0.3 1.0.3
xml ^3.4.0 3.7.0 4.1.0
Transitive dependencies
async 2.4.1
charcode 1.1.3
collection 1.14.11 1.14.12
convert 2.1.1
flutter_web_plugins 0.0.0
http_parser 3.1.4
meta 1.1.8
path 1.6.4
petitparser 3.0.2
plugin_platform_interface 1.0.2
shared_preferences_macos 0.0.1+6
shared_preferences_platform_interface 1.0.3
shared_preferences_web 0.1.2+4
sky_engine 0.0.99
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
url_launcher_macos 0.0.1+4
url_launcher_platform_interface 1.0.6
url_launcher_web 0.1.1+1
vector_math 2.0.8
Dev dependencies
mockito ^4.0.0
pedantic ^1.0.0 1.9.0