execute method

Future<void> execute(
  1. AnalysisResult analysis,
  2. List<OptimizationResult> optimizations,
  3. String outputPath
)

Implementation

Future<void> execute(
  AnalysisResult analysis,
  List<OptimizationResult> optimizations,
  String outputPath,
) async {
  try {
    _state.startReporting();

    // Generate and save analysis report
    await _reportService.saveAnalysisReport(
      analysis,
      '$outputPath/analysis_report.json',
    );

    // Generate and save optimization report
    if (optimizations.isNotEmpty) {
      await _reportService.saveOptimizationReport(
        optimizations,
        '$outputPath/optimization_report.json',
      );
    }

    _state.completeReporting();
  } catch (e) {
    _state.failReporting(e.toString());
    rethrow;
  }
}