updateSelectionWithReason method

Future<void> updateSelectionWithReason(
  1. Selection? selection, {
  2. SelectionUpdateReason reason = SelectionUpdateReason.transaction,
  3. Map? extraInfo,
})

Implementation

Future<void> updateSelectionWithReason(
  Selection? selection, {
  SelectionUpdateReason reason = SelectionUpdateReason.transaction,
  Map? extraInfo,
}) async {
  final completer = Completer<void>();

  if (reason == SelectionUpdateReason.uiEvent) {
    selectionType = SelectionType.inline;
    WidgetsBinding.instance.addPostFrameCallback(
      (timeStamp) => completer.complete(),
    );
  }

  // broadcast to other users here
  selectionExtraInfo = extraInfo;
  _selectionUpdateReason = reason;

  this.selection = selection;

  return completer.future;
}