dart:io
库中IOOverrides
类的用法介绍如下。
使用模拟实现覆盖 dart:io
的各种 API 的工具。
这个抽象基类应该通过重写来扩展构建模拟所需的操作。此基类中的实现默认为实际的dart:io
实现。例如:
class MyDirectory implements Directory {
...
// An implementation of the Directory interface
...
}
void main() {
IOOverrides.runZoned(() {
...
// Operations will use MyDirectory instead of dart:io's Directory
// implementation whenever Directory is used.
...
}, createDirectory: (String path) => new MyDirectory(path));
}
相关用法
- Dart Iterator用法及代码示例
- Dart Iterable.takeWhile用法及代码示例
- Dart Int32x4List.view用法及代码示例
- Dart ImmutableListMixin.replaceRange用法及代码示例
- Dart IterableMixin.isNotEmpty用法及代码示例
- Dart IterableMixin.firstWhere用法及代码示例
- Dart IterableMixin.lastWhere用法及代码示例
- Dart Iterable.skipWhile用法及代码示例
- Dart IterableMixin.every用法及代码示例
- Dart Iterable.toSet用法及代码示例
- Dart ImmutableListMixin.insert用法及代码示例
- Dart Int64List.sublist用法及代码示例
- Dart Iterable.singleWhere用法及代码示例
- Dart Iterable.reduce用法及代码示例
- Dart Iterable.elementAt用法及代码示例
- Dart ImmutableListMixin.addAll用法及代码示例
- Dart Iterable.where用法及代码示例
- Dart IterableMixin.take用法及代码示例
- Dart ImmutableListMixin.shuffle用法及代码示例
- Dart Iterable.lastWhere用法及代码示例
- Dart ImmutableListMixin.retainWhere用法及代码示例
- Dart IterableMixin.any用法及代码示例
- Dart ImmutableListMixin.removeLast用法及代码示例
- Dart Iterable.contains用法及代码示例
- Dart Isolate构造函数用法及代码示例
注:本文由纯净天空筛选整理自dart.dev大神的英文原创作品 IOOverrides class。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。