@@ -125,9 +125,22 @@ class WebSocketProxyService implements VmServiceInterface {
125125
126126 if (! _initializedCompleter.isCompleted) _initializedCompleter.complete ();
127127
128+ // Set up appConnection.onStart listener (like Chrome flow does)
129+ appConn.onStart.then ((_) {
130+ // Unlike Chrome flow, we don't have debugger.resumeFromStart(), but we can trigger resume
131+ if (pauseIsolatesOnStart && ! _hasResumed) {
132+ final resumeEvent = vm_service.Event (
133+ kind: vm_service.EventKind .kResume,
134+ timestamp: DateTime .now ().millisecondsSinceEpoch,
135+ isolate: isolateRef,
136+ );
137+ _hasResumed = true ;
138+ _streamNotify (vm_service.EventStreams .kDebug, resumeEvent);
139+ }
140+ });
141+
128142 // Send pause event if enabled
129143 if (pauseIsolatesOnStart) {
130- print ('JY - isolate paused on start - sending pause event' );
131144 final pauseEvent = vm_service.Event (
132145 kind: vm_service.EventKind .kPauseStart,
133146 timestamp: timestamp,
@@ -142,7 +155,6 @@ class WebSocketProxyService implements VmServiceInterface {
142155 // This handles the case where the app is run from terminal without debug extension
143156 _scheduleAutoResumeIfNeeded ();
144157 } else {
145- print ('JY - isolate not paused on start - sending resume event' );
146158 // If we're not pausing on start, immediately send a resume event
147159 // to ensure the app knows it can start running
148160 _logger.info ('Not pausing on start, sending immediate resume event' );
@@ -592,6 +604,11 @@ class WebSocketProxyService implements VmServiceInterface {
592604 String ? step,
593605 int ? frameIndex,
594606 }) async {
607+ // Check if we should trigger runMain instead
608+ if (! _hasResumed && _currentPauseEvent != null ) {
609+ appConnection.runMain ();
610+ }
611+
595612 // Prevent multiple resume calls
596613 if (_hasResumed && _currentPauseEvent == null ) {
597614 return Success ();
@@ -624,7 +641,6 @@ class WebSocketProxyService implements VmServiceInterface {
624641 /// Schedules an auto-resume if no debugger connection is detected.
625642 /// This prevents the app from being stuck in a paused state when running from terminal.
626643 void _scheduleAutoResumeIfNeeded () {
627- print ('JY - scheduling auto-resume check' );
628644 _logger.info ('Scheduling auto-resume check in 2 seconds' );
629645 // Wait a reasonable amount of time for a debugger to connect
630646 Timer (Duration (seconds: 2 ), () {
0 commit comments