buildWeb method

Future<bool> buildWeb()

Build Flutter web app

Implementation

Future<bool> buildWeb() async {
  _logger.printStep('🔧 Building web...');

  final result = await Process.run('flutter', ['build', 'web', '--release']);

  if (result.exitCode != 0) {
    _logger.printError('Flutter web build failed');
    if (config.verbose) {
      _logger.printError('Error: ${result.stderr}');
    }
    return false;
  }

  // Verify build output exists (always check for 'web' first, then custom name)
  final defaultBuildPath = path.join(config.buildDir, 'web');
  if (!Directory(defaultBuildPath).existsSync()) {
    _logger.printError('Build failed - $defaultBuildPath not found');
    return false;
  }

  _logger.printSuccess('Build completed');
  return true;
}