This question already has an answer here:
In a dart console application, how do I set the current working directory?
import 'dart:io';
...
Directory.current = new Directory('your/path/here');
or just
Directory.current = 'your/path/here';
See also https://api.dartlang.org/133671/dart-io/Directory/current.html
来源:https://stackoverflow.com/questions/33020117/how-to-set-the-current-working-directory-in-dart