Skip to content

Commit 1284367

Browse files
committed
Refactor asset loading in IODirectoryFileSystem and update lw_file_system_api dependency reference
1 parent ddd0761 commit 1284367

File tree

3 files changed

+20
-21
lines changed

3 files changed

+20
-21
lines changed

packages/lw_file_system/lib/src/api/file_system_io.dart

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -121,26 +121,25 @@ class IODirectoryFileSystem extends DirectoryFileSystem {
121121
if (await directory.exists()) {
122122
return FileSystemDirectory(
123123
AssetLocation(path: path, remote: remoteName),
124-
assets: (await directory.list(followLinks: false).toList())
125-
.map((e) {
126-
final current = universalPathContext.join(
127-
path,
128-
p.relative(e.path, from: absolutePath),
124+
assets: (await Future.wait(
125+
(await directory.list(followLinks: false).toList()).map((e) async {
126+
final current = universalPathContext.join(
127+
path,
128+
p.relative(e.path, from: absolutePath),
129+
);
130+
if (e is File) {
131+
return RawFileSystemFile(
132+
AssetLocation(path: current, remote: remoteName),
133+
data: readData ? await e.readAsBytes() : null,
129134
);
130-
if (e is File) {
131-
return RawFileSystemFile(
132-
AssetLocation(path: current, remote: remoteName),
133-
data: readData ? e.readAsBytesSync() : null,
134-
);
135-
} else if (e is Directory) {
136-
return RawFileSystemDirectory(
137-
AssetLocation(path: current, remote: remoteName),
138-
);
139-
}
140-
return null;
141-
})
142-
.nonNulls
143-
.toList(),
135+
} else if (e is Directory) {
136+
return RawFileSystemDirectory(
137+
AssetLocation(path: current, remote: remoteName),
138+
);
139+
}
140+
return null;
141+
}),
142+
)).nonNulls.toList(),
144143
);
145144
}
146145
return null;

packages/lw_file_system/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ dependencies:
2424
git:
2525
url: https://github.com/LinwoodDev/dart_pkgs.git
2626
path: packages/lw_file_system_api
27-
ref: 3f886507656f057d89a8b98de6ddbc7f5a21868e
27+
ref: ddd0761c3ed5a48108bddd0448df76d77eeb9da0
2828
async: ^2.12.0
2929
# path: ^1.8.0
3030

packages/material_leap/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ dependencies:
2727
git:
2828
url: https://github.com/LinwoodDev/dart_pkgs.git
2929
path: packages/lw_file_system_api
30-
ref: 3f886507656f057d89a8b98de6ddbc7f5a21868e
30+
ref: ddd0761c3ed5a48108bddd0448df76d77eeb9da0
3131

3232
dev_dependencies:
3333
flutter_test:

0 commit comments

Comments
 (0)