isDev top-level constant
Determine if the web is running in production mode or not.
To enable production mode, set an environment variable dss
to prod
.
build.yaml
:
targets:
$default:
builders:
build_web_compilers|entrypoint:
options:
compiler: dart2js
dart2js_args:
- --fast-startup
- --minify
- --trust-type-annotations
- --trust-primitives
- -Ddss=prod # This line is needed to enable production mode.
Implementation
const isDev = const String.fromEnvironment('dss') != 'prod'