@@ -27,13 +27,15 @@ class LaunchStep {
2727 final String ? message;
2828 final List <String > logs;
2929 final DateTime ? startTime;
30+ final DateTime ? endTime;
3031
3132 LaunchStep ({
3233 required this .title,
3334 required this .status,
3435 this .message,
3536 this .logs = const [],
3637 DateTime ? startTime,
38+ this .endTime,
3739 }) : startTime = startTime ?? DateTime .now ();
3840
3941 LaunchStep copyWith ({
@@ -42,30 +44,28 @@ class LaunchStep {
4244 String ? message,
4345 List <String >? logs,
4446 DateTime ? startTime,
47+ DateTime ? endTime,
4548 }) {
4649 return LaunchStep (
4750 title: title ?? this .title,
4851 status: status ?? this .status,
4952 message: message ?? this .message,
5053 logs: logs ?? this .logs,
5154 startTime: startTime ?? this .startTime,
55+ endTime: endTime ?? this .endTime,
5256 );
5357 }
5458
5559 LaunchStep addLog (String log) {
5660 return copyWith (logs: [...logs, log]);
5761 }
5862
59- /// Get the duration in seconds since step started
60- double ? get durationSeconds {
61- if (startTime == null ) return null ;
62- return DateTime .now ().difference (startTime! ).inMilliseconds / 1000.0 ;
63- }
64-
6563 /// Get title with duration if step is completed
6664 String get titleWithDuration {
6765 if (status == LaunchStepStatus .completed && startTime != null ) {
68- final duration = DateTime .now ().difference (startTime! ).inMilliseconds / 1000.0 ;
66+ // Use endTime if available (fixed duration), otherwise use current time (for backward compatibility)
67+ final end = endTime ?? DateTime .now ();
68+ final duration = end.difference (startTime! ).inMilliseconds / 1000.0 ;
6969 return '$title (${duration .toStringAsFixed (1 )}s)' ;
7070 }
7171 return title;
0 commit comments