Flutter: make build-time environment variables available to code
问题 How can I have build-time environment variables available to code within a Flutter app? (My specific use case is to inject app version number and commit hash into a debug screen. This information is available at build time, but not at runtime). I had hoped to be able to do something like: flutter run --dart-define=APP_VERSION=0.1.2 And then, const appVersion = String.fromEnvironment('APP_VERSION', defaultValue: 'development'); But this doesn't seem to work (I'm using Flutter 1.12.13+hotfix.5)