app_installer_ohos 1.0.0
app_installer_ohos: ^1.0.0 copied to clipboard
A new ohos app installer plugin, supports opening app stores and editor reviews, as well as installing Apk files.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:app_installer_ohos/app_installer_ohos.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
/// 应用市场信息
String androidAppId = 'com.tengyue360.student';
String iOSAppId = '1440249706';
String ohosAppId = 'yylx.danmaku.bili';
TextEditingController controller=new TextEditingController();
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: Column(
children: <Widget>[
SizedBox(height: 80),
TextButton.icon(
onPressed: () {
AppInstaller.goStore(androidAppId, iOSAppId,ohosAppId);
},
icon: Icon(Icons.store),
label: Text('Go Store'),
),
SizedBox(height: 40),
TextField(
controller:controller,
decoration:InputDecoration(
hintText:'请输入har文件地址:sdcard/app/**.',
),
),
SizedBox(height: 40),
TextButton.icon(
onPressed: () {
String pathFile = controller.text;
if(pathFile != null && pathFile != ''){
AppInstaller.installApk(pathFile);
}
},
icon: Icon(Icons.arrow_downward),
label: Text('Install Apk'),
),
],
),
),
),
);
}
}