smart_app_update_flutter 1.0.8 copy "smart_app_update_flutter: ^1.0.8" to clipboard
smart_app_update_flutter: ^1.0.8 copied to clipboard

A Flutter package to check app updates from the Google Play Store and Apple App Store. Supports force update, soft update, and customizable update dialogs.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:get/get.dart';
import 'package:smart_app_update_flutter/smart_app_update_flutter.dart';
// import 'package:smart_app_update_flutter/smart_app_update.dart';

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

class MyApp extends StatefulWidget {
  const MyApp({super.key});
  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
  @override
  void initState() {
    super.initState();
    WidgetsBinding.instance.addObserver(this);

    // Check for update on app start (without custom API)
    WidgetsBinding.instance.addPostFrameCallback((_) async {
      await AppUpdateManager.checkAndPrompt(
          forceUpdate: false, repeat_totalminutes: 60, notes: "");
    });
  }

  @override
  void didChangeAppLifecycleState(AppLifecycleState state) {
    super.didChangeAppLifecycleState(state);
    if (state == AppLifecycleState.resumed &&
        !UpdateBottomSheet.isUpdateDialogShowing.value) {
      AppUpdateManager.checkAndPrompt(
          forceUpdate: false, repeat_totalminutes: 60, notes: "");
    }
  }

  @override
  Widget build(BuildContext context) {
    return GetMaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Smart App Update Demo',
      home: Scaffold(
        appBar: AppBar(title: const Text('Smart App Update Demo')),
        body: Center(
          child: ElevatedButton(
            onPressed: () async {
              await AppUpdateManager.checkAndPrompt(
                  forceUpdate: false,
                  repeat_totalminutes: 60,
                  notes: "Akhilesh");
            },
            child: const Text('Check for Update'),
          ),
        ),
      ),
    );
  }
}
13
likes
140
points
43
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package to check app updates from the Google Play Store and Apple App Store. Supports force update, soft update, and customizable update dialogs.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, get, http, intl, package_info_plus, shared_preferences, url_launcher

More

Packages that depend on smart_app_update_flutter