scopesRequest method
scopesRequest is called by the client to request all of the variables scopes available for a given stack frame.
Implementation
@override
Future<void> scopesRequest(
Request request,
ScopesArguments args,
void Function(ScopesResponseBody) sendResponse,
) async {
final storedData = isolateManager.getStoredData(args.frameId);
final thread = storedData?.thread;
final data = storedData?.data;
final frameData = data is vm.Frame ? data : null;
final scopes = <Scope>[];
if (frameData != null && thread != null) {
scopes.add(Scope(
name: 'Locals',
presentationHint: 'locals',
variablesReference: thread.storeData(
FrameScopeData(frameData, FrameScopeDataKind.locals),
),
expensive: false,
));
scopes.add(Scope(
name: 'Globals',
presentationHint: 'globals',
variablesReference: thread.storeData(
FrameScopeData(frameData, FrameScopeDataKind.globals),
),
expensive: false,
));
// If the top frame has an exception, add an additional section to allow
// that to be inspected.
final exceptionReference = thread.exceptionReference;
if (exceptionReference != null) {
scopes.add(Scope(
name: 'Exceptions',
variablesReference: exceptionReference,
expensive: false,
));
}
}
sendResponse(ScopesResponseBody(scopes: scopes));
}