requirePermissionToResume method

Future<Success> requirePermissionToResume({
  1. bool onPauseStart = false,
  2. bool onPauseReload = false,
  3. bool onPauseExit = false,
})

The requirePermissionToResume RPC is used to change the pause/resume behavior of isolates.

This provides a way for the VM service to wait for approval to resume from some set of clients. This is useful for clients which want to perform some operation on an isolate after a pause without it being resumed by another client. These clients should invoke readyToResume instead of VmService.resume to indicate to DDS that they have finished their work and the isolate can be resumed.

If the onPauseStart parameter is true, isolates will not resume after pausing on start until the client sends a resume request and all other clients which need to provide resume approval for this pause type have done so.

If the onPauseReload parameter is true, isolates will not resume after pausing after a reload until the client sends a resume request and all other clients which need to provide resume approval for this pause type have done so.

If the onPauseExit parameter is true, isolates will not resume after pausing on exit until the client sends a resume request and all other clients which need to provide resume approval for this pause type have done so.

Important Notes:

  • All clients with the same client name share resume permissions. Only a single client of a given name is required to provide resume approval.
  • When a client requiring approval disconnects from the service, a paused isolate may resume if all other clients requiring resume approval have already given approval. In the case that no other client requires resume approval for the current pause event, the isolate will be resumed if at least one other client has attempted to resume the isolate.
  • Resume permission behavior can be bypassed using the VmService.resume RPC, which is treated as a user-initiated resume that force resumes the isolate. Tooling relying on resume permissions should use readyToResume instead of VmService.resume to avoid force resuming the isolate.

Implementation

Future<Success> requirePermissionToResume({
  bool onPauseStart = false,
  bool onPauseReload = false,
  bool onPauseExit = false,
}) async {
  // No version check needed, present since v1.0 of the protocol.
  return _callHelper<Success>(
    'requirePermissionToResume',
    args: {
      'onPauseStart': onPauseStart,
      'onPauseReload': onPauseReload,
      'onPauseExit': onPauseExit,
    },
  );
}