commandGuard method

bool Function() commandGuard()

A guard for delayed input, such as a file picker's result: false once another operation has started, even one since cancelled, or the document changed. Call immediately before performing.

Implementation

bool Function() commandGuard() {
  final controller = _controller;
  controller._requireWritable();
  final participant = controller._participant;
  final operationSequence = participant.operationSequence;
  final document = controller.state.document;
  final wasIdle = participant.active == null;
  return () =>
      !controller.isDisposed &&
      wasIdle &&
      identical(controller._participant, participant) &&
      participant.active == null &&
      participant.operationSequence == operationSequence &&
      identical(controller.state.document, document);
}