flutter dart-define在第一次构建时不加载,仅在热重启时加载

roejwanj  于 2023-10-22  发布在  Flutter
关注(0)|答案(2)|浏览(130)

嗨,我为我现有的应用程序设置风味,遇到了String. fromEnvironment错误。只有当我点击“热重启”时,它才能得到正确的味道
Im using Flutter 3.7.10 Here are my flutter doctor -v logs:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.7.10, on macOS 13.3.1 22E772610a darwin-arm64, locale en-VN)
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    ! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.79.2)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

! Doctor found issues in 1 category.
tungakanui@Tnuis-MacBook-Pro avia-flutter % fvm flutter doctor -v
[✓] Flutter (Channel stable, 3.7.10, on macOS 13.3.1 22E772610a darwin-arm64, locale en-VN)
    • Flutter version 3.7.10 on channel stable at /Users/tungakanui/fvm/versions/3.7.10
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 4b12645012 (3 months ago), 2023-04-03 17:46:48 -0700
    • Engine revision ec975089ac
    • Dart version 2.19.6
    • DevTools version 2.20.1

[!] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/tungakanui/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    ! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses

[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E300c
    • CocoaPods version 1.12.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] VS Code (version 1.79.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.64.0

[✓] Connected device (3 available)
    • iPhone 14 Pro (mobile) • BF0C1972-F6B0-4164-BDBF-59D6BCF6B117 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-16-4 (simulator)
    • macOS (desktop)        • macos                                • darwin-arm64   • macOS 13.3.1 22E772610a darwin-arm64
    • Chrome (web)           • chrome                               • web-javascript • Google Chrome 114.0.5735.198

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.

我想在第一个初始化中获得正确的Flavor

neekobn8

neekobn81#

检查文件:ios/Runner.xcodeproj/project.pdxproject并删除所有

buildSettings = {
   DART_DEFINES = "" // <- remove here
}
gkl3eglg

gkl3eglg2#

您是否使用自定义.xcconfig文件?如果是这样的话,请尝试在自定义.xcconfig文件的底部添加这一行,假设这些文件位于Runner文件夹中。

include“../Flutter/Generated.xcconfig”

相关问题