forked from firka/flutter
fix type error in manifest asset bundle (#42791)
This commit is contained in:
@@ -94,7 +94,7 @@ class _ManifestAssetBundle implements AssetBundle {
|
||||
if (!directory.existsSync()) {
|
||||
return true; // directory was deleted.
|
||||
}
|
||||
for (File file in directory.listSync()) {
|
||||
for (File file in directory.listSync().whereType<File>()) {
|
||||
final DateTime dateTime = file.statSync().modified;
|
||||
if (dateTime == null) {
|
||||
continue;
|
||||
|
||||
@@ -148,6 +148,35 @@ name: example''')
|
||||
FileSystem: () => testFileSystem,
|
||||
ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
|
||||
});
|
||||
|
||||
// https://github.com/flutter/flutter/issues/42723
|
||||
testUsingContext('Test regression for mistyped file', () async {
|
||||
fs.file(fs.path.join('assets', 'foo', 'bar.txt')).createSync(recursive: true);
|
||||
// Create a directory in the same path to test that we're only looking at File
|
||||
// objects.
|
||||
fs.directory(fs.path.join('assets', 'foo', 'bar')).createSync();
|
||||
fs.file('pubspec.yaml')
|
||||
..createSync()
|
||||
..writeAsStringSync(r'''
|
||||
name: example
|
||||
flutter:
|
||||
assets:
|
||||
- assets/foo/
|
||||
''');
|
||||
fs.file('.packages').createSync();
|
||||
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
||||
await bundle.build(manifestPath: 'pubspec.yaml');
|
||||
// Expected assets:
|
||||
// - asset manifest
|
||||
// - font manifest
|
||||
// - license file
|
||||
// - assets/foo/bar.txt
|
||||
expect(bundle.entries.length, 4);
|
||||
expect(bundle.needsBuild(manifestPath: 'pubspec.yaml'), false);
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => testFileSystem,
|
||||
ProcessManager: () => FakeProcessManager(<FakeCommand>[]),
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user