From 41192d6a96ae7925a343b33e957c8628d6a08490 Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Sat, 8 May 2021 15:42:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20=E6=89=93=E5=8C=85?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/main.dart | 3 ++- tool/grind.dart | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/main.dart b/lib/main.dart index ee91a01..19d11c6 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -28,7 +28,8 @@ void main() async { // await AmapCore.init(''); // await AmapLocation.instance.init(iosKey: ''); JPush jpush = new JPush(); - DevUtil.setDev(true); + const isProduct = const bool.fromEnvironment('ISPRODUCT'); + DevUtil.setDev(!isProduct); jpush.addEventHandler( // 接收通知回调方法。 onReceiveNotification: (Map message) async { diff --git a/tool/grind.dart b/tool/grind.dart index 707ddd6..caa93b4 100644 --- a/tool/grind.dart +++ b/tool/grind.dart @@ -13,3 +13,20 @@ build() { @Task() clean() => defaultClean(); + +@Task() +buildApk() async { + await runAsync('flutter', arguments: [ + 'build', + 'apk', + '--target-platform=android-arm64', + '--dart-define', + 'ISPRODUCT=true' + ]); +} + +@Task() +buildIos() async { + await runAsync('flutter', + arguments: ['build', 'ios', '--dart-define', 'BUILD_TYPE=PRODUCT']); +}