devOnlyPluginsIn static method

Set<String> devOnlyPluginsIn(
  1. String text,
  2. String platform
)

The native plugins for platform that only dev dependencies bring, from the text of a project's .flutter-plugins-dependencies; empty when it is not that file.

Implementation

static Set<String> devOnlyPluginsIn(String text, String platform) {
  final Object? json;
  try {
    json = jsonDecode(text);
  } on FormatException {
    return {};
  }
  final plugins = json is Map ? json['plugins'] : null;
  final list = plugins is Map ? plugins[platform] : null;
  if (list is! List) return {};
  return {
    for (final p in list)
      if (p is Map && p['dev_dependency'] == true && p['name'] is String)
        p['name'] as String,
  };
}