kooboo_flutter_app_upgrade 0.0.9 copy "kooboo_flutter_app_upgrade: ^0.0.9" to clipboard
kooboo_flutter_app_upgrade: ^0.0.9 copied to clipboard

flutter app upgrade

example/lib/main.dart

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

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

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
    WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
      FlutterAppUpgrade.onListenStreamData(
        (event) {
          if (event is Map && event.containsKey('progress')) {
            debugPrint(
                '_MyAppState.initState progress ${event['progress'] * 100}');
          } else {
            debugPrint('_MyAppState.initState receive data $event');
          }
        },
        onError: (error) {
          debugPrint('_MyAppState.initState receive error ${error.message}');
        },
      );
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Column(
          children: <Widget>[
            TextButton(
              onPressed: () async {
                FlutterAppUpgrade.downloadApkInstall(
                    'url',
                    '1.0.1');
              },
              child: const Text('下载并安装Apk(仅适用于Android)'),
            ),
            const SizedBox(
              height: 10,
            ),
            TextButton(
              onPressed: () async {
                FlutterAppUpgrade.patchInstallAppForAndroid(
                    'app-V1.0_2.0.patch');
              },
              child: const Text('增量更新Apk(仅适用于Android)'),
            ),
            const SizedBox(
              height: 10,
            ),
            TextButton(
              onPressed: () async {
                FlutterAppUpgrade.goToMarket();
              },
              child: const Text('跳转应用市场(仅适用于Android)'),
            ),
            const SizedBox(
              height: 10,
            ),
            TextButton(
              onPressed: () async {
                FlutterAppUpgrade.goToAppStore('432274380');
              },
              child: const Text('跳转AppStore(仅适用于iOS)'),
            ),
            const SizedBox(
              height: 10,
            ),
          ],
        ),
      ),
    );
  }
}
2
likes
150
points
26
downloads

Publisher

unverified uploader

Weekly Downloads

flutter app upgrade

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter

More

Packages that depend on kooboo_flutter_app_upgrade