Use tearoffs (#122091)

Use tearoffs in TestRenderingFlutterBinding
This commit is contained in:
Tomasz Gucio 2023-03-08 00:11:39 +01:00 committed by GitHub
parent 2181c75bb6
commit 43190156db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -112,9 +112,7 @@ class TestRenderingFlutterBinding extends BindingBase with SchedulerBinding, Ser
/// to test [SchedulerPhase.postFrameCallbacks].
void pumpCompleteFrame() {
final FlutterExceptionHandler? oldErrorHandler = FlutterError.onError;
FlutterError.onError = (FlutterErrorDetails details) {
_errors.add(details);
};
FlutterError.onError = _errors.add;
try {
TestRenderingFlutterBinding.instance.handleBeginFrame(null);
TestRenderingFlutterBinding.instance.handleDrawFrame();
@ -139,9 +137,7 @@ class TestRenderingFlutterBinding extends BindingBase with SchedulerBinding, Ser
void drawFrame() {
assert(phase != EnginePhase.build, 'rendering_tester does not support testing the build phase; use flutter_test instead');
final FlutterExceptionHandler? oldErrorHandler = FlutterError.onError;
FlutterError.onError = (FlutterErrorDetails details) {
_errors.add(details);
};
FlutterError.onError = _errors.add;
try {
pipelineOwner.flushLayout();
if (phase == EnginePhase.layout) {