@@ -6,8 +6,6 @@ import 'dart:convert';
6
6
import 'dart:io' ;
7
7
import 'dart:typed_data' ;
8
8
9
- import 'package:pool/pool.dart' ;
10
-
11
9
/// The filesystem the build is running on.
12
10
///
13
11
/// Methods behave as the `dart:io` methods with the same names, with some
@@ -77,25 +75,21 @@ abstract interface class Filesystem {
77
75
78
76
/// The `dart:io` filesystem.
79
77
class IoFilesystem implements Filesystem {
80
- /// Pool for async file operations.
81
- final _pool = Pool (32 );
82
-
83
78
@override
84
- Future <bool > exists (String path) => _pool. withResource ( File (path).exists);
79
+ Future <bool > exists (String path) => File (path).exists ( );
85
80
86
81
@override
87
82
bool existsSync (String path) => File (path).existsSync ();
88
83
89
84
@override
90
- Future <Uint8List > readAsBytes (String path) =>
91
- _pool.withResource (File (path).readAsBytes);
85
+ Future <Uint8List > readAsBytes (String path) => File (path).readAsBytes ();
92
86
93
87
@override
94
88
Uint8List readAsBytesSync (String path) => File (path).readAsBytesSync ();
95
89
96
90
@override
97
91
Future <String > readAsString (String path, {Encoding encoding = utf8}) =>
98
- _pool. withResource (() => File (path).readAsString (encoding: encoding) );
92
+ File (path).readAsString (encoding: encoding);
99
93
100
94
@override
101
95
String readAsStringSync (String path, {Encoding encoding = utf8}) =>
@@ -108,19 +102,15 @@ class IoFilesystem implements Filesystem {
108
102
}
109
103
110
104
@override
111
- Future <void > delete (String path) {
112
- return _pool.withResource (() async {
113
- final file = File (path);
114
- if (await file.exists ()) await file.delete ();
115
- });
105
+ Future <void > delete (String path) async {
106
+ final file = File (path);
107
+ if (await file.exists ()) await file.delete ();
116
108
}
117
109
118
110
@override
119
- Future <void > deleteDirectory (String path) {
120
- return _pool.withResource (() async {
121
- final directory = Directory (path);
122
- if (await directory.exists ()) await directory.delete (recursive: true );
123
- });
111
+ Future <void > deleteDirectory (String path) async {
112
+ final directory = Directory (path);
113
+ if (await directory.exists ()) await directory.delete (recursive: true );
124
114
}
125
115
126
116
@override
@@ -135,12 +125,10 @@ class IoFilesystem implements Filesystem {
135
125
}
136
126
137
127
@override
138
- Future <void > writeAsBytes (String path, List <int > contents) {
139
- return _pool.withResource (() async {
140
- final file = File (path);
141
- await file.parent.create (recursive: true );
142
- await file.writeAsBytes (contents);
143
- });
128
+ Future <void > writeAsBytes (String path, List <int > contents) async {
129
+ final file = File (path);
130
+ await file.parent.create (recursive: true );
131
+ await file.writeAsBytes (contents);
144
132
}
145
133
146
134
@override
@@ -159,12 +147,10 @@ class IoFilesystem implements Filesystem {
159
147
String path,
160
148
String contents, {
161
149
Encoding encoding = utf8,
162
- }) {
163
- return _pool.withResource (() async {
164
- final file = File (path);
165
- await file.parent.create (recursive: true );
166
- await file.writeAsString (contents, encoding: encoding);
167
- });
150
+ }) async {
151
+ final file = File (path);
152
+ await file.parent.create (recursive: true );
153
+ await file.writeAsString (contents, encoding: encoding);
168
154
}
169
155
}
170
156
0 commit comments