buildPlatform static method

Future<bool> buildPlatform(
  1. String platform
)

Implementation

static Future<bool> buildPlatform(String platform) async {
  final String flutterPath = Helpers.getFlutterPath();

  ProcessResult res;

  switch (platform) {
    case 'ios':
      res = await Helpers.executeCommand('$flutterPath build ios --release');
      break;
    case 'android':
      res = await Helpers.executeCommand('$flutterPath build apk --release');
      break;
    case 'web':
      res = await Helpers.executeCommand('$flutterPath build web --release');
      break;
    case 'macos':
      res =
          await Helpers.executeCommand('$flutterPath build macos --release');
      break;
    case 'windows':
      res = await Helpers.executeCommand(
          '$flutterPath build windows --release');
      break;
    case 'linux':
      res =
          await Helpers.executeCommand('$flutterPath build linux --release');
      break;
    default:
      print('❌ Unsupported platform: $platform');
      return false;
  }

  // ✅ Log command result for debugging
  if (res.exitCode == 0) {
    print('✅ Build successful for $platform: ${res.stdout}');
  } else {
    print('❌ Build failed for $platform: ${res.stderr}');
  }

  return res.exitCode == 0;
}