@@ -27,7 +27,7 @@ void main() {
2727 test ('saves and reads binary data successfully' , () async {
2828 const filePath = 'test_file' ;
2929 final data = Uint8List .fromList ([1 , 2 , 3 , 4 , 5 ]);
30- final size = await storage.saveFile (filePath, data);
30+ final size = await storage.saveFile (filePath, Stream . value ( data) );
3131 expect (size, equals (data.length));
3232
3333 final resultStream = storage.readFile (filePath);
@@ -56,7 +56,7 @@ void main() {
5656
5757 expect (await nonExistentDir.exists (), isFalse);
5858
59- final size = await storage.saveFile (filePath, data);
59+ final size = await storage.saveFile (filePath, Stream . value ( data) );
6060 expect (size, equals (data.length));
6161 expect (await nonExistentDir.exists (), isTrue);
6262
@@ -77,7 +77,7 @@ void main() {
7777
7878 expect (await nestedDir.exists (), isFalse);
7979
80- final size = await storage.saveFile (filePath, data);
80+ final size = await storage.saveFile (filePath, Stream . value ( data) );
8181 expect (size, equals (data.length));
8282 expect (await nestedDir.exists (), isTrue);
8383
@@ -96,8 +96,8 @@ void main() {
9696 final originalData = Uint8List .fromList ([1 , 2 , 3 ]);
9797 final newData = Uint8List .fromList ([4 , 5 , 6 , 7 ]);
9898
99- await storage.saveFile (filePath, originalData);
100- final size = await storage.saveFile (filePath, newData);
99+ await storage.saveFile (filePath, Stream . value ( originalData) );
100+ final size = await storage.saveFile (filePath, Stream . value ( newData) );
101101 expect (size, equals (newData.length));
102102
103103 final resultStream = storage.readFile (filePath);
@@ -113,9 +113,8 @@ void main() {
113113 test ('saveFile with empty data writes empty file and returns 0 size' ,
114114 () async {
115115 const filePath = 'empty_file' ;
116- final emptyBytes = Uint8List (0 );
117116
118- final size = await storage.saveFile (filePath, emptyBytes );
117+ final size = await storage.saveFile (filePath, Stream . empty () );
119118 expect (size, 0 );
120119
121120 final resultStream = storage.readFile (filePath);
@@ -136,7 +135,7 @@ void main() {
136135 ];
137136 final expectedBytes =
138137 Uint8List .fromList (chunks.expand ((c) => c).toList ());
139- await storage.saveFile (filePath, expectedBytes);
138+ await storage.saveFile (filePath, Stream . value ( expectedBytes) );
140139
141140 final outChunks = await storage.readFile (filePath).toList ();
142141 final outBytes = Uint8List .fromList (
@@ -147,7 +146,7 @@ void main() {
147146
148147 test ('fileExists becomes false after deleteFile' , () async {
149148 const filePath = 'exists_then_delete' ;
150- await storage.saveFile (filePath, Uint8List .fromList ([1 ]));
149+ await storage.saveFile (filePath, Stream . value ( Uint8List .fromList ([1 ]) ));
151150 expect (await storage.fileExists (filePath), isTrue);
152151 await storage.deleteFile (filePath);
153152 expect (await storage.fileExists (filePath), isFalse);
@@ -159,7 +158,7 @@ void main() {
159158
160159 // Create a file, then re-initialize again
161160 const filePath = 'idempotent_test' ;
162- await storage.saveFile (filePath, Uint8List .fromList ([9 ]));
161+ await storage.saveFile (filePath, Stream . value ( Uint8List .fromList ([9 ]) ));
163162 await storage.initialize ();
164163
165164 // File should still exist (initialize should not clear data)
@@ -184,7 +183,7 @@ void main() {
184183 test ('supports unicode and emoji filenames' , () async {
185184 const filePath = '測試_файл_📷.bin' ;
186185 final bytes = Uint8List .fromList ([10 , 20 , 30 , 40 ]);
187- await storage.saveFile (filePath, bytes);
186+ await storage.saveFile (filePath, Stream . value ( bytes) );
188187
189188 final out = await storage.readFile (filePath).toList ();
190189 expect (out, equals ([bytes]));
@@ -196,7 +195,7 @@ void main() {
196195 () async {
197196 const filePath = 'with_media_type' ;
198197 final data = Uint8List .fromList ([1 , 2 , 3 ]);
199- await storage.saveFile (filePath, data);
198+ await storage.saveFile (filePath, Stream . value ( data) );
200199
201200 final result =
202201 await storage.readFile (filePath, mediaType: 'image/jpeg' ).toList ();
@@ -209,7 +208,7 @@ void main() {
209208 const filePath = 'delete_test' ;
210209 final data = Uint8List .fromList ([1 , 2 , 3 ]);
211210
212- await storage.saveFile (filePath, data);
211+ await storage.saveFile (filePath, Stream . value ( data) );
213212 expect (await storage.fileExists (filePath), isTrue);
214213
215214 await storage.deleteFile (filePath);
@@ -258,7 +257,7 @@ void main() {
258257 const filePath = 'exists_test' ;
259258 final data = Uint8List .fromList ([1 , 2 , 3 ]);
260259
261- await storage.saveFile (filePath, data);
260+ await storage.saveFile (filePath, Stream . value ( data) );
262261 expect (await storage.fileExists (filePath), isTrue);
263262
264263 await d.file (filePath, data).validate ();
@@ -276,7 +275,7 @@ void main() {
276275 const filePath = 'file with spaces & symbols!@#' ;
277276 final data = Uint8List .fromList ([1 , 2 , 3 ]);
278277
279- final size = await storage.saveFile (filePath, data);
278+ final size = await storage.saveFile (filePath, Stream . value ( data) );
280279 expect (size, equals (data.length));
281280
282281 final resultStream = storage.readFile (filePath);
@@ -301,7 +300,7 @@ void main() {
301300 ),
302301 );
303302 }
304- final size = await storage.saveFile (filePath, data);
303+ final size = await storage.saveFile (filePath, Stream . value ( data) );
305304 expect (size, equals (data.length));
306305
307306 final resultStream = storage.readFile (filePath);
@@ -321,7 +320,7 @@ void main() {
321320
322321 for (int i = 0 ; i < fileCount; i++ ) {
323322 final data = Uint8List .fromList ([i, i + 1 , i + 2 ]);
324- futures.add (storage.saveFile ('file_$i ' , data));
323+ futures.add (storage.saveFile ('file_$i ' , Stream . value ( data) ));
325324 }
326325
327326 await Future .wait (futures);
@@ -346,8 +345,8 @@ void main() {
346345 final data1 = Uint8List .fromList ([1 , 2 , 3 ]);
347346 final data2 = Uint8List .fromList ([4 , 5 , 6 ]);
348347 final futures = [
349- storage.saveFile (filePath, data1),
350- storage.saveFile (filePath, data2),
348+ storage.saveFile (filePath, Stream . value ( data1) ),
349+ storage.saveFile (filePath, Stream . value ( data2) ),
351350 ];
352351
353352 await Future .wait (futures);
0 commit comments