update_app 0.0.5
update_app: ^0.0.5 copied to clipboard
Update the app, pass in the updated address, and update the app. The Android part is implemented using DownloadManager. If the file has been downloaded, it will be installed directly. The Ios section [...]
example/lib/main.dart
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:update_app/update_app.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Update app'),
),
body: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text('click right bottom download button download!'),
Text('Adapt to Android 6.0'),
Text('Adapt to Android 7.0'),
Text('Adapt to Android 8.0'),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: download,
child: Icon(Icons.file_download),
),
),
);
}
void download() async {
var name = await UpdateApp.updateApp(
url: "https://mofada.cn/apks/example.apk", appleId: "375380948");
print(name);
setState(() {});
}
}