From e2214be9821f031ecd91e970343c7035627669dd Mon Sep 17 00:00:00 2001 From: laiiihz Date: Fri, 7 May 2021 16:49:33 +0800 Subject: [PATCH] run app with dart-define --- lib/main.dart | 3 ++- tool/grind.dart | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/main.dart b/lib/main.dart index 5aea23b1..c2f4b4ba 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -17,7 +17,8 @@ import 'package:aku_community/utils/developer_util.dart'; import 'package:aku_community/utils/headers.dart'; void main() async { - DeveloperUtil.setDev(true); + const buildType = const String.fromEnvironment('BUILD_TYPE'); + DeveloperUtil.setDev(!(buildType.contains('PRODUCT'))); WidgetsFlutterBinding.ensureInitialized(); ///firebase crashlytics initalize diff --git a/tool/grind.dart b/tool/grind.dart index 35be28bf..e2261420 100644 --- a/tool/grind.dart +++ b/tool/grind.dart @@ -13,6 +13,8 @@ buildApk() async { 'build', 'apk', '--target-platform=android-arm64', + '--dart-define', + 'BUILD_TYPE=PRODUCT', ], ); } @@ -24,6 +26,8 @@ buildIos() async { arguments: [ 'build', 'ios', + '--dart-define', + 'BUILD_TYPE=PRODUCT', ], ); }