new_version_plus 1.0.1 copy "new_version_plus: ^1.0.1" to clipboard
new_version_plus: ^1.0.1 copied to clipboard

Check if your user has the most recent version of your Flutter app.

☕ Support Me #

If you find this plugin useful, please consider supporting me:

Buy Me a Coffee

Note #

Original repository: https://pub.dev/packages/new_version

The problem with the original repository is that it will no longer be maintained by the creator, for this reason this repository was created in order to maintain updated code and make respective improvements as long as it is required.

New Version Plus Plugin 🎉 #

A Flutter plugin that makes it possible to:

  • Check if a user has the most recent version of your app installed.
  • Show the user an alert with a link to the appropriate app store page.
  • NEW: Integrate with Relva API for centralized version management with rollout control, force updates, and customizable UI.

See more at the Dart Packages page.

Screenshots

🆕 What's New: Relva API Integration (Beta) #

We've added a powerful new feature that integrates with the Relva API for centralized version management. This allows you to:

  • ✅ Control version updates from a centralized dashboard
  • ✅ Force updates when critical
  • ✅ Customizable UI via API configuration
  • ⏳ Gradual rollout (percentage-based) - Coming soon
  • ⏳ Device-based tracking - Coming soon

Status: Currently in Beta - We're testing this feature with the community to gather feedback before the official release. As this is an MVP, features and request limits will be adjusted based on community acceptance.

Relva API Plans #

Plan Requests/Month Status
Free 1,000 ✅ Available
Plus 100,000 ⏳ Coming Soon (Payment gateway pending)
Pro 1,000,000 ⏳ Coming Soon (Payment gateway pending)

Important: As this is an MVP in beta to gauge community acceptance, request limits may be adjusted and increased based on community feedback and adoption. Plus and Pro plans are not yet available due to pending payment gateway integration. If you need more than 1,000 requests/month, you can request a manual upgrade (see Support & Upgrades below).

Installation #

Add new_version_plus as a dependency in your pubspec.yaml file.

dependencies:
  new_version_plus: ^1.0.0

Usage #

Option 1: Traditional App Store Check (Original Feature) #

In main.dart (or wherever your app is initialized), create an instance of NewVersionPlus.

final newVersionPlus = NewVersionPlus();

The plugin will automatically use your Flutter package identifier to check the app store. If your app has a different identifier in the Google Play Store or Apple App Store, you can overwrite this by providing values for androidId and/or iOSId.

For iOS: If your app is only available outside the U.S. App Store, you will need to set iOSAppStoreCountry to the two-letter country code of the store you want to search. See http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 for a list of ISO Country Codes.

Quickstart

Calling showAlertIfNecessary with your app's BuildContext will check if the app can be updated, and will automatically display a platform-specific alert that the user can use to go to the app store.

newVersionPlus.showAlertIfNecessary(context: context);

Advanced 😎

If you want to create a custom alert or use the app version information differently, call getVersionStatus. This will return a Future<VersionStatus> with information about the local and app store versions of the app.

final status = await newVersionPlus.getVersionStatus();
status.canUpdate // (true)
status.localVersion // (1.2.1)
status.storeVersion // (1.2.3)
status.appStoreLink // (https://itunes.apple.com/us/app/google/id284815942?mt=8)

If you want to present a customized dialog, you can pass your VersionStatus to showUpdateDialog().

newVersionPlus.showUpdateDialog(
  context: context,
  versionStatus: status,
  dialogTitle: 'Custom dialog title',
  dialogText: 'Custom dialog text',
  updateButtonText: 'Custom update button text',
  dismissButtonText: 'Custom dismiss button text',
  dismissAction: () => functionToRunAfterDialogDismissed(),
)

The option was added so that in the android app you can modify the code of your country, with the variable: androidPlayStoreCountry

Option 2: Relva API Integration (NEW - Beta) #

Use the Relva API for centralized version management. The API is already integrated in the plugin - you only need to provide your API Key.

Quick Setup

import 'package:new_version_plus/new_version_plus.dart';
import 'package:new_version_plus/strategies/api_version_source.dart';

// Configure the plugin
final newVersion = NewVersionPlus(
  versionSource: ApiVersionSource(
    apiKey: 'YOUR_API_KEY', // Get this from your Relva dashboard
    useNewApiFormat: true,
  ),
);

// Check for updates and show dialog automatically
await newVersion.showModernUpdateDialogIfNecessary(
  context: context,
);

Getting Started with Relva API

  1. Get your API Key: Sign up at Relva Dashboard and create an API Key
  2. Register your App: Add your app with the correct bundleId (package name)
  3. Create Versions: Add version entries with rollout percentages and force update settings
  4. Integrate: Use the code above in your Flutter app

Complete Example

import 'package:flutter/material.dart';
import 'package:new_version_plus/new_version_plus.dart';
import 'package:new_version_plus/strategies/api_version_source.dart';

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'My App',
      home: const HomePage(),
    );
  }
}

class HomePage extends StatefulWidget {
  const HomePage({super.key});

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  late final NewVersionPlus newVersion;

  @override
  void initState() {
    super.initState();
    
    // Configure Relva API integration
    newVersion = NewVersionPlus(
      versionSource: ApiVersionSource(
        apiKey: 'YOUR_API_KEY', // Use environment variables in production
        useNewApiFormat: true,
      ),
    );
    
    // Check for updates on app start
    WidgetsBinding.instance.addPostFrameCallback((_) {
      _checkForUpdates();
    });
  }

  Future<void> _checkForUpdates() async {
    await newVersion.showModernUpdateDialogIfNecessary(
      context: context,
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('My App')),
      body: Center(
        child: ElevatedButton(
          onPressed: _checkForUpdates,
          child: const Text('Check for Updates'),
        ),
      ),
    );
  }
}

Features

  • Force Updates: Prevent users from dismissing critical updates
  • Customizable UI: Configure dialog appearance via API (uiConfig)
  • Automatic Rollout: Gradual rollout based on device ID - Coming soon
  • Device Tracking: Consistent rollout experience per device - Coming soon

For detailed documentation, see FLUTTER_VERSION_CHECK_GUIDE.md

Support & Upgrades #

Reporting Issues or Suggesting Improvements #

This is an MVP project in beta to gauge community acceptance. We welcome your feedback!

  • Bugs/Fixes: Email support@codesfirst.com with subject: relva fix
  • Feature Requests/Improvements: Email support@codesfirst.com with subject: relva improvement

Manual Plan Upgrades #

Since Plus and Pro plans are not yet available through automated payment, you can request a manual upgrade:

Email: support@codesfirst.com
Subject: upgrade plan to [PLAN] [PERIOD]

Examples:

  • upgrade plan to plus monthly
  • upgrade plan to pro annual
  • upgrade plan to plus annual

We'll process your request manually and provide you with an upgraded API Key.

Contributing #

We welcome contributions! Since this is a community-driven project, any improvements, fixes, or suggestions are highly appreciated.

License #

See LICENSE file for details.

Acknowledgments #

  • Original new_version package creators
  • Flutter community for feedback and support

Made with ❤️ by CodesFirst

181
likes
140
points
30.3k
downloads

Publisher

verified publishercodesfirst.com

Weekly Downloads

Check if your user has the most recent version of your Flutter app.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

device_info_plus, flutter, http, package_info_plus, url_launcher

More

Packages that depend on new_version_plus