make FlutterProject synchronous (#31757)
diff --git a/packages/flutter_tools/lib/src/flutter_manifest.dart b/packages/flutter_tools/lib/src/flutter_manifest.dart
index 4a04029..5eb94d1 100644
--- a/packages/flutter_tools/lib/src/flutter_manifest.dart
+++ b/packages/flutter_tools/lib/src/flutter_manifest.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-import 'dart:async';
-
import 'package:meta/meta.dart';
import 'package:pub_semver/pub_semver.dart';
import 'package:yaml/yaml.dart';
@@ -27,22 +25,22 @@
}
/// Returns null on invalid manifest. Returns empty manifest on missing file.
- static Future<FlutterManifest> createFromPath(String path) async {
+ static FlutterManifest createFromPath(String path) {
if (path == null || !fs.isFileSync(path))
return _createFromYaml(null);
- final String manifest = await fs.file(path).readAsString();
+ final String manifest = fs.file(path).readAsStringSync();
return createFromString(manifest);
}
/// Returns null on missing or invalid manifest
@visibleForTesting
- static Future<FlutterManifest> createFromString(String manifest) async {
+ static FlutterManifest createFromString(String manifest) {
return _createFromYaml(loadYaml(manifest));
}
- static Future<FlutterManifest> _createFromYaml(dynamic yamlDocument) async {
+ static FlutterManifest _createFromYaml(dynamic yamlDocument) {
final FlutterManifest pubspec = FlutterManifest._();
- if (yamlDocument != null && !await _validate(yamlDocument))
+ if (yamlDocument != null && !_validate(yamlDocument))
return null;
final Map<dynamic, dynamic> yamlMap = yamlDocument;
@@ -289,7 +287,7 @@
/// This method should be kept in sync with the schema in
/// `$FLUTTER_ROOT/packages/flutter_tools/schema/pubspec_yaml.json`,
/// but avoid introducing depdendencies on packages for simple validation.
-Future<bool> _validate(YamlMap manifest) async {
+bool _validate(YamlMap manifest) {
final List<String> errors = <String>[];
for (final MapEntry<dynamic, dynamic> kvp in manifest.entries) {
if (kvp.key is! String) {