-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
Consider this pubspec manifest:
name: test
dependencies:
flutter:
sdk: flutter
flutter:
deferred-components:
- name: blah
assets: blahNotice that, under the first and only deferred component, assets has a string value rather than a list.
In this case, the tool will print an error: Expected "assets" key in the 0 element of "deferred-components" to be a list, but got blah (String). However, the value is not a list, so the error is inaccurate.
Interestingly, providing assets: blah directly under flutter results in more accurate error text: Expected "assets" to be a list, but got blah (String).\n This is a result of us using completely separate parsing and validation code for parsing the top-level assets section and the assets sections under any deferred components.
flutter/packages/flutter_tools/test/general.shard/flutter_manifest_test.dart
Lines 1444 to 1463 in 9644aa8
| testWithoutContext('FlutterManifest deferred component assets is list', () async { | |
| const String manifest = ''' | |
| name: test | |
| dependencies: | |
| flutter: | |
| sdk: flutter | |
| flutter: | |
| deferred-components: | |
| - name: blah | |
| assets: blah | |
| '''; | |
| final BufferLogger logger = BufferLogger.test(); | |
| final FlutterManifest? flutterManifest = FlutterManifest.createFromString( | |
| manifest, | |
| logger: logger, | |
| ); | |
| expect(flutterManifest, null); | |
| expect(logger.errorText, 'Expected "assets" key in the 0 element of "deferred-components" to be a list, but got blah (String).\n'); | |
| }); |