Unverified Commit 2512163e authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Allow Android to be missing from multi-platform manifest (#50304)

parent e6e14b0d
......@@ -161,7 +161,11 @@ class FlutterManifest {
if (isPlugin) {
final YamlMap plugin = _flutterDescriptor['plugin'] as YamlMap;
if (plugin.containsKey('platforms')) {
return plugin['platforms']['android']['package'] as String;
final YamlMap platforms = plugin['platforms'] as YamlMap;
if (platforms.containsKey('android')) {
return platforms['android']['package'] as String;
}
} else {
return plugin['androidPackage'] as String;
}
......
......@@ -387,7 +387,8 @@ flutter:
expect(flutterManifest.isPlugin, true);
expect(flutterManifest.androidPackage, 'com.example');
});
test('allows a multi-plat plugin declaration', () async {
test('allows a multi-plat plugin declaration with android only', () async {
const String manifest = '''
name: test
flutter:
......@@ -402,6 +403,20 @@ flutter:
expect(flutterManifest.androidPackage, 'com.example');
});
test('allows a multi-plat plugin declaration with ios only', () async {
const String manifest = '''
name: test
flutter:
plugin:
platforms:
ios:
pluginClass: HelloPlugin
''';
final FlutterManifest flutterManifest = FlutterManifest.createFromString(manifest);
expect(flutterManifest.isPlugin, true);
expect(flutterManifest.androidPackage, isNull);
});
testUsingContext('handles an invalid plugin declaration', () async {
const String manifest = '''
name: test
......
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