Skip to main content

flutter_in_app_updater 1.1.0 copy "flutter_in_app_updater: ^1.1.0" to clipboard
flutter_in_app_updater: ^1.1.0 copied to clipboard

A unified Flutter plugin to handle native in-app updates (Google Play & App StoreKit) and custom server-driven API checks with forced/soft updates and custom UI support.

example/lib/main.dart

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

void main() {
  runApp(const MyApp());
}

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

  @override
  Widget build(BuildContext context) {
    // 1. MaterialApp is at the absolute root
    return const MaterialApp(home: HomeScreen());
  }
}

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

  @override
  State<HomeScreen> createState() => _HomeScreenState();
}

class _HomeScreenState extends State<HomeScreen> {
  @override
  void initState() {
    super.initState();

    // 2. This context now correctly has MaterialApp and MaterialLocalizations as ancestors
    WidgetsBinding.instance.addPostFrameCallback((_) {
      FlutterInAppUpdater.updateViaCustomApi(
        context: context,
        fetchConfigFromApi: () async {
          return {
            'min_required_version': '9.9.9', // Triggers update dialog
            'forced_update': false,
            'update_url_android': 'https://play.google.com/store/apps/details?id=your.package.name',
            'release_notes': 'Testing custom update dialog locally.',
          };
        },
        bypassInDebug: false, // Allows testing in debug mode
      );
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Plugin Example')),
      body: Center(
        child: ElevatedButton(
          onPressed: () async {
            /* // Use this for Native update
            FlutterInAppUpdater.updateNative(
                immediateAndroid: true,
                iosAppStoreId: '123456789',
              );*/

            /* // Use this for custom api
            FlutterInAppUpdater.updateViaCustomApi(
              context: context,
              fetchConfigFromApi: () async {
                return {
                  'min_required_version': '1.0.1',
                  'forced_update': false,
                  'update_url_android': 'https://play.google.com/store/apps/details?id=your.package.name',
                  'release_notes': 'Testing manual trigger.',
                };
              },
              bypassInDebug: false,
            );*/

            // Use this for Enterprise apps which are hosted on own company server or AWS or Firebase or Drives
            await EnterpriseInstaller.downloadAndInstall(
              context: context,
              apkUrl: 'http://localhost:8000/MyTestApp.apk',
              forcedUpdate: true,
              bypassInDebug: false,
            );
          },
          child: const Text('Trigger Custom Update Check'),
        ),
      ),
    );
  }
}
2
likes
160
points
236
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A unified Flutter plugin to handle native in-app updates (Google Play & App StoreKit) and custom server-driven API checks with forced/soft updates and custom UI support.

Repository (GitHub)
View/report issues

Topics

#update #in-app-updates #version-check #enterprise #sideloading

License

BSD-3-Clause (license)

Dependencies

flutter, http, package_info_plus, path_provider, url_launcher

More

Packages that depend on flutter_in_app_updater

Packages that implement flutter_in_app_updater