Sachin Saini
 · FlutterFlow Expert

In App Updates [Cracked]

Easily Integrate the Custom Action in your App without any extra luggage.

Step 1: Create a Custom Action: inAppUpdate

Step 2: Add Dependency: in_app_update: ^4.2.2

Step 3: Copy And Paste the below code to Code Editor:

// Automatic FlutterFlow imports
import '/backend/backend.dart';
import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart';
import '/custom_code/actions/index.dart'; // Imports other custom actions
import '/flutter_flow/custom_functions.dart'; // Imports custom functions
import 'package:flutter/material.dart';
// Begin custom action code
// DO NOT REMOVE OR MODIFY THE CODE ABOVE!

import 'package:in_app_update/in_app_update.dart';

Future inAppUpdate() async {
  // Check for App update from play store using the package
  // Check for available update
  await InAppUpdate.checkForUpdate().then((updateInfo) {
    if (updateInfo.updateAvailability == UpdateAvailability.updateAvailable) {
      // Update is available, prompt user to update
      InAppUpdate.performImmediateUpdate().catchError((e) => print(e));
    }
  }).catchError((e) => print(e));
}

Step 4: Add the Custom Action in Initial Action of main.dart!

If you need any help in Integration you can Get help via Book 1:1 Session

Thanks to AI!

19
24 replies