Unverified Commit 883cb3e8 authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Migrate pubspec_schema to null safety (#83441)

parent e905dd2d
......@@ -2,30 +2,35 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import 'package:flutter_tools/src/flutter_manifest.dart';
import 'package:flutter_tools/src/globals_null_migrated.dart' as globals;
import 'package:meta/meta.dart';
import 'package:yaml/yaml.dart';
import 'common.dart';
/// Check if the pubspec.yaml file under the `projectDir` is valid for a plugin project.
void validatePubspecForPlugin({@required String projectDir, @required String pluginClass, @required List<String> expectedPlatforms, List<String> unexpectedPlatforms = const <String>[], String androidIdentifier, String webFileName}) {
final FlutterManifest manifest = FlutterManifest.createFromPath(projectDir+'/pubspec.yaml', fileSystem: globals.fs, logger: globals.logger);
final YamlMap platformsMap = YamlMap.wrap(manifest.supportedPlatforms);
for (final String platform in expectedPlatforms) {
expect(platformsMap[platform], isNotNull);
expect(platformsMap[platform]['pluginClass'], pluginClass);
if (platform == 'android') {
expect(platformsMap[platform]['package'], androidIdentifier);
}
if (platform == 'web') {
expect(platformsMap[platform]['fileName'], webFileName);
}
void validatePubspecForPlugin({
required String projectDir,
required String pluginClass,
required List<String> expectedPlatforms,
List<String> unexpectedPlatforms = const <String>[],
String? androidIdentifier,
String? webFileName,
}) {
final FlutterManifest manifest =
FlutterManifest.createFromPath(projectDir + '/pubspec.yaml', fileSystem: globals.fs, logger: globals.logger)!;
final YamlMap platformsMap = YamlMap.wrap(manifest.supportedPlatforms!);
for (final String platform in expectedPlatforms) {
expect(platformsMap[platform], isNotNull);
expect(platformsMap[platform]['pluginClass'], pluginClass);
if (platform == 'android') {
expect(platformsMap[platform]['package'], androidIdentifier);
}
for (final String platform in unexpectedPlatforms) {
expect(platformsMap[platform], isNull);
if (platform == 'web') {
expect(platformsMap[platform]['fileName'], webFileName);
}
}
for (final String platform in unexpectedPlatforms) {
expect(platformsMap[platform], isNull);
}
}
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