in packages/devtools_app/lib/src/debugger/debugger_controller.dart [569:655]
void _handleDebugEvent(Event event) {
_log.log('event: ${event.kind}');
// We're resuming and another isolate has started in a paused state,
// resume any pauseState isolates.
if (_resuming.value &&
event.isolate.id != isolateRef?.id &&
event.kind == EventKind.kPauseStart) {
_resumeIsolatePauseStart(event);
}
if (event.isolate.id != isolateRef?.id) return;
_lastEvent = event;
switch (event.kind) {
case EventKind.kResume:
_pause(false);
break;
case EventKind.kPauseStart:
case EventKind.kPauseExit:
case EventKind.kPauseBreakpoint:
case EventKind.kPauseInterrupted:
case EventKind.kPauseException:
case EventKind.kPausePostRequest:
// Any event we receive here indicates that any resume/step request has been
// processed.
_resuming.value = false;
_pause(true, pauseEvent: event);
break;
// TODO(djshuckerow): switch the _breakpoints notifier to a 'ListNotifier'
// that knows how to notify when performing a list edit operation.
case EventKind.kBreakpointAdded:
_breakpoints.value = [..._breakpoints.value, event.breakpoint];
// ignore: unawaited_futures
_createBreakpointWithLocation(event.breakpoint).then((bp) {
final list = [
..._breakpointsWithLocation.value,
bp,
]..sort();
_breakpointsWithLocation.value = list;
});
break;
case EventKind.kBreakpointResolved:
_breakpoints.value = [
for (var b in _breakpoints.value)
if (b != event.breakpoint) b,
event.breakpoint
];
// ignore: unawaited_futures
_createBreakpointWithLocation(event.breakpoint).then((bp) {
final list = _breakpointsWithLocation.value.toList();
// Remote the bp with the older, unresolved information from the list.
list.removeWhere((breakpoint) => bp.breakpoint.id == bp.id);
// Add the bp with the newer, resolved information.
list.add(bp);
list.sort();
_breakpointsWithLocation.value = list;
});
break;
case EventKind.kBreakpointRemoved:
final breakpoint = event.breakpoint;
// Update _selectedBreakpoint if necessary.
if (_selectedBreakpoint.value?.breakpoint == breakpoint) {
_selectedBreakpoint.value = null;
}
_breakpoints.value = [
for (var b in _breakpoints.value)
if (b != breakpoint) b
];
_breakpointsWithLocation.value = [
for (var b in _breakpointsWithLocation.value)
if (b.breakpoint != breakpoint) b
];
break;
}
}