native_updater 0.0.1 copy "native_updater: ^0.0.1" to clipboard
native_updater: ^0.0.1 copied to clipboard

outdated

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

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

146
likes
0
pub points
81%
popularity

Publisher

verified publisherofload.com

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

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, package_info, url_launcher

More

Packages that depend on native_updater