Unverified Commit 68e768db authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

fix type error in manifest asset bundle (#42791)

parent 31cb4482
......@@ -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>[]),
});
});
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment