projectPlatformChecks function

List<DoctorCheck> projectPlatformChecks(
  1. Directory project
)

What doctor says about the keys that turn Flutter GPU on for an application (decision 54): FLTEnableFlutterGPU and FLTEnableImpeller in macos/Runner/Info.plist and ios/Runner/Info.plist, and io.flutter.embedding.android.EnableFlutterGPU in Android's manifest.

A missing key fails nothing, which is why it is a problem here. The application opens, Impeller will not start, and flutter3d_app draws through the software rasteriser; the banner and the log line say so, but only after somebody has wondered why the frame rate is single figures. Only a project that reaches flutter3d_impeller gets a line, since a browser build reads none of these keys, and only for the platform folders it has.

Implementation

List<DoctorCheck> projectPlatformChecks(Directory project) {
  final PluginDiscovery discovery;
  try {
    discovery = discoverPlugins(project);
  } on PluginDiscoveryException {
    return const <DoctorCheck>[];
  }
  if (!discovery.dependencies.contains('flutter3d_impeller')) {
    return const <DoctorCheck>[];
  }
  return <DoctorCheck>[
    for (final (platform, folder) in const <(String, String)>[
      ('macOS', 'macos'),
      ('iOS', 'ios'),
    ])
      if (File('${project.path}/$folder/Runner/Info.plist') case final plist
          when plist.existsSync())
        _plistCheck(platform, '$folder/Runner/Info.plist', plist),
    if (File('${project.path}/$_androidManifest') case final manifest
        when manifest.existsSync())
      _manifestCheck(manifest),
  ];
}