getSelection method

Future<EditorSelection?> getSelection()

Get the current editor selection.

Implementation

Future<EditorSelection?> getSelection() async {
  final response = await request(
    BridgeMessage(type: BridgeMessageType.getSelection),
  );
  if (response.type == BridgeMessageType.selectionResponse &&
      response.payload.isNotEmpty) {
    return EditorSelection.fromJson(response.payload);
  }
  return null;
}