auto_in_app_update 0.0.4 copy "auto_in_app_update: ^0.0.4" to clipboard
auto_in_app_update: ^0.0.4 copied to clipboard

PlatformAndroid

A lightweight Flutter package for automatic in-app update handling on Android (using in_app_update) with a placeholder for iOS.

πŸš€ auto_in_app_update #

A lightweight Flutter package for automatically checking and initiating in-app updates on Android using the in_app_update plugin. On iOS, it logs a placeholder message (you can implement update logic using packages like upgrader).


✨ Features #

  • βœ… Automatically checks for updates on app startup
  • πŸš€ Supports both flexible and immediate updates on Android
  • πŸͺΆ No UI integration required β€” plug and play
  • πŸ”§ Logs a message for iOS (custom update logic can be added)
  • 🧠 Designed to be called only once (prevents multiple checks)

πŸ“¦ Installation #

1️⃣ Add Dependency #

In your pubspec.yaml file:

dependencies:
  flutter:
    sdk: flutter
  auto_in_app_update: ^0.0.3

Then run:

flutter pub get

2️⃣ Android Setup #

Ensure your Android project is configured correctly:

βœ… Set Minimum SDK Version

Open android/app/build.gradle and set:

defaultConfig {
  minSdkVersion 21
}

⚠️ Note:

  • Works only on real Android devices with Google Play Store.
  • Does not work on emulators or non-GMS (Google Mobile Services) devices.

πŸš€ Usage #

Step 1: Import and Initialize #

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

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  // βœ… Automatically checks for available updates on app startup
  await AutoInAppUpdate.checkForUpdate();

  runApp(MyApp());
}

Step 2: Your App UI #

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Auto In-App Update Demo',
      theme: ThemeData(primarySwatch: Colors.blue),
      home: HomeScreen(),
    );
  }
}

class HomeScreen extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('Home')),
      body: Center(child: Text('Welcome to the updated app!')),
    );
  }
}

πŸ“± Platform Behavior #

Platform Behavior
Android Checks for updates on launch. Performs immediate update if allowed, else flexible update.
iOS Logs: iOS update check: Use Upgrader widget in your app. You can add your own iOS update prompt using upgrader.

πŸ§ͺ Advanced Example (Optional Logging) #

await AutoInAppUpdate.checkForUpdate().then((_) {
  print('Update check complete.');
}).catchError((e) {
  print('Update check failed: $e');
});

❓FAQ #

Q: Will this package show any update UI?
A: No β€” this package is headless. All update prompts come from Play Store’s native UI based on update type (immediate/flexible).

Q: Can I use this for iOS?
A: Not directly. For iOS, consider integrating upgrader and managing the update flow manually with a BuildContext.


0
likes
160
points
24
downloads

Publisher

verified publisherbhai4you.com

Weekly Downloads

A lightweight Flutter package for automatic in-app update handling on Android (using in_app_update) with a placeholder for iOS.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, in_app_update

More

Packages that depend on auto_in_app_update