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。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。