Allow Android to be missing from multi-platform manifest (#50304)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user