loadManifestFromFile function

Future<PluginManifest?> loadManifestFromFile(
  1. String path
)

Load a plugin manifest from a JSON file at path.

Returns null if the file does not exist or is unparseable.

Implementation

Future<PluginManifest?> loadManifestFromFile(String path) async {
  final file = File(path);
  if (!await file.exists()) return null;

  try {
    final json = jsonDecode(await file.readAsString());
    if (json is! Map<String, dynamic>) return null;
    return parseManifest(json);
  } catch (_) {
    return null;
  }
}