receiveFromFrontend method

  1. @override
void receiveFromFrontend(
  1. int? id,
  2. String method,
  3. Map<String, dynamic>? params
)

Implementation

@override
void receiveFromFrontend(int? id, String method, Map<String, dynamic>? params) async {
  switch (method) {
    case 'startScreencast':
      sendToFrontend(id, null);
      _devToolsMaxWidth = params?['maxWidth'] ?? 0;
      _devToolsMaxHeight = params?['maxHeight'] ?? 0;
      startScreenCast();
      break;
    case 'stopScreencast':
      sendToFrontend(id, null);
      stopScreenCast();
      break;
    case 'screencastFrameAck':
      sendToFrontend(id, null);
      handleScreencastFrameAck(params!);
      break;
    case 'getResourceContent':
      String? url = params!['url'];
      sendToFrontend(id,
          JSONEncodableMap({'content': devtoolsService.controller?.getResourceContent(url), 'base64Encoded': false}));
      break;
    case 'reload':
      sendToFrontend(id, null);
      handleReloadPage();
      break;
    default:
      sendToFrontend(id, null);
  }
}