setupRecordingOnDrawFrame method
Setup the Http recording client to be available on every frame draw.
Must be called during the testWidgets callback function. Successive calls of this function are safe and will have no additional side effects. testRecordingWidgets calls this method for you automatically.
This setup is needed to ensure Http recording client works correctly in integration tests.
Implementation
void setupRecordingOnDrawFrame() {
final dispatcher = PlatformDispatcher.instance;
final onDrawFrameRef = _onDrawFrameRefHolder[dispatcher];
if (onDrawFrameRef == null) {
final onDrawFrame = dispatcher.onDrawFrame;
_onDrawFrameRefHolder[dispatcher] = onDrawFrame;
if (onDrawFrame != null) {
dispatcher.onDrawFrame = () => run((_) => onDrawFrame());
}
}
}