TL;DR
final isProd = bool.fromEnvironment('dart.vm.product');
config文件示例 (config.dart)
class _Config {
final isProd = bool.fromEnvironment('dart.vm.product');
String get appName => isProd ? 'App' : 'App (Debug)';
String get apiBaseUrl => isProd
? 'https://example.com/v1'
: 'https://dev.example.com/v1';
}
final config = _Config();