handleDrawFrame method Null safety

  1. @override
void handleDrawFrame()
override

Called by the engine to produce a new frame.

This method is called immediately after handleBeginFrame. It calls all the callbacks registered by addPersistentFrameCallback, which typically drive the rendering pipeline, and then calls the callbacks registered by addPostFrameCallback.

See handleBeginFrame for a discussion about debugging hooks that may be useful when working with frame callbacks.

Implementation

@override
void handleDrawFrame() {
  assert(_doDrawThisFrame != null);
  if (_doDrawThisFrame!) {
    super.handleDrawFrame();
  }
  _doDrawThisFrame = null;
  _viewNeedsPaint = false;
  _expectingFrameToReassemble = false;
  if (_expectingFrame) { // set during pump
    assert(_pendingFrame != null);
    _pendingFrame!.complete(); // unlocks the test API
    _pendingFrame = null;
    _expectingFrame = false;
  } else if (framePolicy != LiveTestWidgetsFlutterBindingFramePolicy.benchmark) {
    platformDispatcher.scheduleFrame();
  }
}