framePolicy property

LiveTestWidgetsFlutterBindingFramePolicy framePolicy
getter/setter pair

The strategy for pumping and requesting new frames.

The policy decides whether pump (with a duration) pumps a single frame (as would happen in a normal test environment using AutomatedTestWidgetsFlutterBinding), or pumps every frame that the system requests during an asynchronous pause (as would normally happen when running an application with WidgetsFlutterBinding).

The default is LiveTestWidgetsFlutterBindingFramePolicy.fadePointers. Setting this to anything other than LiveTestWidgetsFlutterBindingFramePolicy.onlyPumps results in pumping extra frames, which might involve calling builders more, or calling paint callbacks more, etc, and might interfere with the test. If you know that your test won't be affected by this, you can set the policy to LiveTestWidgetsFlutterBindingFramePolicy.fullyLive or LiveTestWidgetsFlutterBindingFramePolicy.benchmarkLive in that particular file.

To set a value while still allowing the test file to work as a normal test, add the following code to your test file at the top of your void main() { } function, before calls to testWidgets:

TestWidgetsFlutterBinding binding = TestWidgetsFlutterBinding.ensureInitialized();
if (binding is LiveTestWidgetsFlutterBinding) {
  binding.framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.onlyPumps;
}

See LiveTestWidgetsFlutterBindingFramePolicy.

Implementation

LiveTestWidgetsFlutterBindingFramePolicy framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.fadePointers;