txt的例子
https://blog.csdn.net/s1120080286/article/details/83239453
import 'dart:io';
void main(){
fun1();
fun2();
fun3();
}
void fun1() {
var directory = new Directory("temp1");
directory.createSync();
//absolute返回path为绝对路径的Directory对象
print(directory.absolute.path);
}
void fun2() {
new Directory("temp2").create().then(
(dir) => print(dir.absolute.path)
);
}
//Dart中变量的类型可以省略,包括函数
fun3() async {
var directory = await new Directory("temp3").create();
print(directory.absolute.path);
}
输出
- E:\DartProject\Note16\temp1
- E:\DartProject\Note16\temp2
- E:\DartProject\Note16\temp3