在我的.bashrc文件中:
export DART_SDK=/home/nicolas/dart/dart-sdk
Run Code Online (Sandbox Code Playgroud)
在命令行中,它在我"回显"它时起作用.但我无法看到这个用户变量dart,我只看系统变量而不是我的:
var env = Platform.environment;
env.forEach((k,v) => print("Key=$k Value=$v"));
Run Code Online (Sandbox Code Playgroud)
我试过了:
我的用户变量定义不明确吗?我的代码不好吗?这是一个错误?
Cut*_*tch 15
使用以下代码:
import 'dart:io'; // Server side / command line only package.
main() {
Map<String, String> env = Platform.environment;
env.forEach((k, v) => print("Key=$k Value=$v"));
}
Run Code Online (Sandbox Code Playgroud)
我能够在Windows和Mac上覆盖环境变量.在Mac上我必须将行添加到.bash_profile(我的Mac上没有加载.bashrc).
约翰
以下是dart docs的链接:https://api.dartlang.org/1.13.0/dart-io/Platform-class.html
| 归档时间: |
|
| 查看次数: |
2180 次 |
| 最近记录: |