Unverified Commit d8092d99 authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Fix YamlMap cast error (#49253)

parent 3800bb7b
......@@ -342,8 +342,9 @@ bool _validate(YamlMap manifest) {
}
if (kvp.value is! YamlMap) {
errors.add('Expected "${kvp.key}" section to be an object or null, but got ${kvp.value}.');
}
} else {
_validateFlutter(kvp.value as YamlMap, errors);
}
break;
default:
// additionalProperties are allowed.
......
......@@ -641,6 +641,21 @@ flutter:
expect(assets[1].path, 'lib/gallery/abc%3Fxyz');
expect(assets[2].path, 'lib/gallery/aaa%20bbb');
});
testUsingContext('Returns proper error when flutter is a list instead of a map', () async {
const String manifest = '''
name: test
dependencies:
flutter:
sdk: flutter
flutter:
- uses-material-design: true
''';
final FlutterManifest flutterManifest = FlutterManifest.createFromString(manifest);
expect(flutterManifest, null);
expect(testLogger.errorText, contains('Expected "flutter" section to be an object or null, but got [{uses-material-design: true}].'));
});
});
group('FlutterManifest with MemoryFileSystem', () {
......
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