nativeBuildPlatforms function

List<String> nativeBuildPlatforms(
  1. String pubspecContent
)

Platforms under flutter.plugin.platforms that build the engine themselves (ffiPlugin: true or a pluginClass:) — the ones that double-bundle with a code asset. Ignores comment lines; web has no native build.

Implementation

List<String> nativeBuildPlatforms(String pubspecContent) {
  final out = <String>[];
  for (final plat in const ['android', 'ios', 'macos', 'windows', 'linux']) {
    final block = _pubspecBlock(pubspecContent, plat);
    if (block == null) continue;
    final live = block.split('\n').where((l) => !l.trimLeft().startsWith('#')).join('\n');
    if (RegExp(r'ffiPlugin:\s*true').hasMatch(live) || RegExp(r'pluginClass:\s*\S').hasMatch(live)) {
      out.add(plat);
    }
  }
  return out;
}