requestPerformanceMode method

PerformanceModeRequestHandle? requestPerformanceMode(
  1. DartPerformanceMode mode

Request a specific DartPerformanceMode.

Returns null if the request was not successful due to conflicting performance mode requests. Two requests are said to be in conflict if they are not of the same DartPerformanceMode type, and an explicit request for a performance mode has been made prior.

Requestor is responsible for calling PerformanceModeRequestHandle.dispose when it no longer requires the performance mode.


PerformanceModeRequestHandle? requestPerformanceMode(DartPerformanceMode mode) {
  // conflicting requests are not allowed.
  if (_performanceMode != null && _performanceMode != mode) {
    return null;

  if (_performanceMode == mode) {
    assert(_numPerformanceModeRequests > 0);
  } else if (_performanceMode == null) {
    assert(_numPerformanceModeRequests == 0);
    _performanceMode = mode;
    _numPerformanceModeRequests = 1;

  return PerformanceModeRequestHandle._(_disposePerformanceModeRequest);