upgrader 0.2.0

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new50

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

A simple prompt widget is displayed when a newer app version is availabe in the store.

Example

Just wrap your body widget in the UpgradeAlert widget. It will handle the rest.

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

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

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

  @override
  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

image

Customization

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

  • buttonTitleIgnore: the ignore button title, which defaults to Ignore

  • buttonTitleRemind: the remind button title, which defaults to Later

  • buttonTitleUpdate: the update button title, which defaults to Update Now

  • daysUntilAlertAgain: days until alerting user again, which defaults to 3

  • debugEnabled: Enable print statements for debugging, which defaults to false

  • onIgnore: Called when the ignore button is tapped, defaults to null

  • onLater: Called when the ignore button is tapped, defaults to null

  • onUpdate: Called when the ignore 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?

Limitations

This widget works 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. Support for Android coming soon.

iTunes Search API

There is a class in this Flutter package used by the UpgradeAlert widget to download app details from the iTunes Serach API. The class ITunesSearchAPI can be used standalone with the UpgradeAlert widget to query iTunes for app details.

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

Results

image

Contributing

All comments and pull requests are welcome.

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.

example/lib/main.dart

/*
 * Copyright (c) 2018 Larry Aasen. All rights reserved.
 */

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

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

class MyApp extends StatelessWidget {
  MyApp({
    Key key,
  }) : super(key: key) {
    Upgrader().clearSavedSettings();
    Upgrader().installAppStoreVersion('1.1.0');
    Upgrader().installAppStoreListingURL(
        'https://itunes.apple.com/us/app/google-maps-transit-food/id585027354?mt=8&uo=4');
  }

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

Use this package as a library

1. Depend on it

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


dependencies:
  upgrader: ^0.2.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support flutter packages 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';
  
Version Uploaded Documentation Archive
0.2.0 Dec 12, 2018 Go to the documentation of upgrader 0.2.0 Download upgrader 0.2.0 archive
0.1.0 Dec 3, 2018 Go to the documentation of upgrader 0.1.0 Download upgrader 0.1.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
50
Learn more about scoring.

We analyzed this package on Dec 12, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.7
  • Flutter: 1.0.0

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/src/upgrade_alert.dart. (-0.50 points)

Analysis of lib/src/upgrade_alert.dart reported 1 hint:

line 10 col 7: This class inherits from a class marked as @immutable, and therefore should be immutable (all instance fields must be final).

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
http ^0.12.0 0.12.0
package_info ^0.3.2 0.3.2
shared_preferences ^0.4.3 0.4.3
url_launcher ^4.0.2 4.0.2
version ^1.0.3 1.0.3
Transitive dependencies
async 2.0.8
charcode 1.1.2
collection 1.14.11
http_parser 3.1.3
meta 1.1.6
path 1.6.2
sky_engine 0.0.99
source_span 1.4.1
string_scanner 1.0.4
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test
mockito ^4.0.0