From b0765ac03eea596a4dc7a246189a6089c1af00c6 Mon Sep 17 00:00:00 2001 From: Benson Luk <97480502+b-luk@users.noreply.github.com> Date: Tue, 1 Feb 2022 19:34:05 +0000 Subject: [PATCH] Use `??=` over testing for null. --- lib/web_ui/lib/src/engine/canvaskit/surface.dart | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/web_ui/lib/src/engine/canvaskit/surface.dart b/lib/web_ui/lib/src/engine/canvaskit/surface.dart index 91ba89d53fd15..f0e8a149574e0 100644 --- a/lib/web_ui/lib/src/engine/canvaskit/surface.dart +++ b/lib/web_ui/lib/src/engine/canvaskit/surface.dart @@ -138,9 +138,7 @@ class Surface { /// Creates a and SkSurface for the given [size]. CkSurface createOrUpdateSurface(ui.Size size) { if (useH5vccCanvasKit) { - if (_surface == null) { - _surface = CkSurface(canvasKit.getH5vccSkSurface(), null); - } + _surface ??= CkSurface(canvasKit.getH5vccSkSurface(), null); return _surface!; }