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']); +}