app_upgrader 0.1.2 copy "app_upgrader: ^0.1.2" to clipboard
app_upgrader: ^0.1.2 copied to clipboard

a Flutter package designed to handle application upgrades seamlessly.

example/lib/main.dart

import 'dart:io';

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

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

// dummy json data for Android Version Info from your own service
// or firebase config
Map<String, dynamic> androidVersionInfo = {
  "41452": {"update_type": "forceUpdate"},
  "41451": {"update_type": "flexible"},
  "41450": {"update_type": "none"}
};
// dummy json data for iOS Version Info from your own service
// or firebase config
Map<String, dynamic> iosVersionInfo = {
  "10.3.1": {"update_type": "forceUpdate"},
  "10.3.0": {"update_type": "none"},
  "10.2.9": {"update_type": "flexible"},
};

class MyVersionInfoFetcher implements VersionInfoFetcher {
  // you can use your own service or firebase remote config.
  // for example we use dummy json data
  @override
  Future<Map<String, dynamic>> fetchVersionInfo() {
    final versionInfo =
        Platform.isAndroid ? androidVersionInfo : iosVersionInfo;
    return Future.value(versionInfo);
  }
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'App Upgrader Test App',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: AppUpgrader(
          // for example, telegram bundleId added
          bundleId: Platform.isAndroid
              ? 'org.telegram.messenger'
              : 'ph.telegra.Telegraph',
          versionInfoFetcher: MyVersionInfoFetcher(),
          child: const MyHomePage(title: 'App Upgrader Test App')),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: const Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[Text('Prod App with App Updater')],
        ),
      ),
    );
  }
}
16
likes
130
points
47
downloads

Publisher

unverified uploader

Weekly Downloads

a Flutter package designed to handle application upgrades seamlessly.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

collection, flutter, html, http, in_app_update, package_info_plus, url_launcher

More

Packages that depend on app_upgrader