How do I find the current directory, in Dart?

十年热恋 提交于 2019-12-19 05:33:40

问题


I want to know what the current directory is. I don't want to shell out to run pwd. Is there an easy way to do this in Dart?


回答1:


Indeed there is!

import 'dart:io';

main() {
  Directory current = Directory.current;
}

Note: this only works on the command-line, not in the browser.

Read more about the API docs for Directory.current.



来源:https://stackoverflow.com/questions/19436793/how-do-i-find-the-current-directory-in-dart

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