native_updater 0.0.1

  • Readme
  • Changelog
  • Installing
  • 67

native_updater #

Flutter package for prompting users to update with native dialog when there is a newer version of the app in the store.

When a newer app version is available via user defined logic, a simple alert prompt widget is displayed. With today's modern app stores, there is little need to persuade users to update because most of them are already using the auto update 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 update sooner.

The UI comes in two flavors: Material Design for Android and Cupertino for iOS. The UpgradeMaterialAlert widget is used to display the native Android alert prompt, and the UpgradeCupertinoAlert widget is used to display the native iOS alert prompt.

Installation via GitHub (for test only) #

dependencies:
  flutter:
    sdk: flutter
  cupertino_icons: ^0.1.3

  # Add this inside pubspec.yaml
  native_updater:
    git: https://github.com/loadsmileau/native_updater

Additional setting for iOS #

To be able to show your App Name in the Cupertino Alert Dialog, add the following keys to your Info.plist file, located in <project root>/ios/Runner/Info.plist:

<key>CFBundleDisplayName</key>
<string>YOUR APP NAME</string>

Usage #

Just add this code inside the initState() life cycle method on the first home screen of your app, and it will handle the rest.

Future.delayed(Duration.zero, () {
  NativeUpdater.displayUpdateAlert(
    context: context,
    requiresUpdate: true,
    appStoreUrl: '<Your App Store URL>',
  );
});

Full Example #

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

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'native_updater example',
      home: Home(),
    );
  }
}

class Home extends StatefulWidget {
  @override
  _HomeState createState() => _HomeState();
}

class _HomeState extends State<Home> {
  @override
  void initState() {
    super.initState();

    Future.delayed(Duration.zero, () {
      NativeUpdater.displayUpdateAlert(
        context: context,
        requiresUpdate: true,
        appStoreUrl: '<Your App Store URL>',
      );
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Your App'),
      ),
      body: Center(
        child: Text('Testing...'),
      ),
    );
  }
}

Screenshot of Material Alert #

image

Screenshot of Cupertino Alert #

image

[0.0.1] - 03/18/2020 #

  • Initial Open Source release.

Use this package as a library

1. Depend on it

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


dependencies:
  native_updater: ^0.0.1

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:native_updater/native_updater.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
43
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
67
Learn more about scoring.

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

  • Dart: 2.8.4
  • pana: 0.13.9+1
  • Flutter: 1.17.3

Analysis suggestions

Package does not support Flutter platform linux

Because of import path [package:native_updater/native_updater.dart, package:native_updater/src/native_updater.dart, package:native_updater/src/upgrade_cupertino_alert.dart, package:url_launcher/url_launcher.dart]

Package does not support Flutter platform web

Because of import path [package:native_updater/native_updater.dart, package:native_updater/src/native_updater.dart, package:package_info/package_info.dart]

Package does not support Flutter platform windows

Because of import path [package:native_updater/native_updater.dart, package:native_updater/src/native_updater.dart, package:native_updater/src/upgrade_cupertino_alert.dart, package:url_launcher/url_launcher.dart]

Package not compatible with SDK dart

because of import path [native_updater]

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and native_updater.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
package_info ^0.4.0+16 0.4.1
url_launcher ^5.4.2 5.4.10
Transitive dependencies
collection 1.14.12
flutter_web_plugins 0.0.0
meta 1.1.8
platform_detect 1.4.0
plugin_platform_interface 1.0.2
pub_semver 1.4.4
sky_engine 0.0.99
typed_data 1.1.6
url_launcher_macos 0.0.1+7
url_launcher_platform_interface 1.0.7
url_launcher_web 0.1.1+6
vector_math 2.0.8
Dev dependencies
flutter_test