Access to user environment variable

╄→尐↘猪︶ㄣ 提交于 2019-11-29 09:30:15
Cutch

Using the following code:

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"));
}

I was able to override environment variables on both Windows and Mac. On Mac I had to add the line to .bash_profile (.bashrc is not loaded on my Mac).

John

Here is the link to dart docs: https://api.dartlang.org/1.13.0/dart-io/Platform-class.html

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!