use null aware operators for function invocations (#79049)

diff --git a/dev/integration_tests/flutter_gallery/lib/demo/shrine/category_menu_page.dart b/dev/integration_tests/flutter_gallery/lib/demo/shrine/category_menu_page.dart
index 891ee40..c7068d0 100644
--- a/dev/integration_tests/flutter_gallery/lib/demo/shrine/category_menu_page.dart
+++ b/dev/integration_tests/flutter_gallery/lib/demo/shrine/category_menu_page.dart
@@ -25,9 +25,7 @@
           GestureDetector(
             onTap: () {
               model.setCategory(category);
-              if (onCategoryTap != null) {
-                onCategoryTap!();
-              }
+              onCategoryTap?.call();
             },
             child: model.selectedCategory == category
               ? Column(
diff --git a/dev/integration_tests/flutter_gallery/lib/demo/transformations/transformations_demo_color_picker.dart b/dev/integration_tests/flutter_gallery/lib/demo/transformations/transformations_demo_color_picker.dart
index d2a1b69..62c9126 100644
--- a/dev/integration_tests/flutter_gallery/lib/demo/transformations/transformations_demo_color_picker.dart
+++ b/dev/integration_tests/flutter_gallery/lib/demo/transformations/transformations_demo_color_picker.dart
@@ -27,9 +27,7 @@
           color: color,
           selected: color == selectedColor,
           onTap: () {
-            if (onColorSelection != null) {
-              onColorSelection!(color);
-            }
+            onColorSelection?.call(color);
           },
         );
       }).toList(),
@@ -59,9 +57,7 @@
       child: RawMaterialButton(
         fillColor: color,
         onPressed: () {
-          if (onTap != null) {
-            onTap!();
-          }
+          onTap?.call();
         },
         child: !selected ? null : const Icon(
           Icons.check,
diff --git a/dev/integration_tests/flutter_gallery/lib/demo/transformations/transformations_demo_gesture_transformable.dart b/dev/integration_tests/flutter_gallery/lib/demo/transformations/transformations_demo_gesture_transformable.dart
index b3d3f13..d1f5b62 100644
--- a/dev/integration_tests/flutter_gallery/lib/demo/transformations/transformations_demo_gesture_transformable.dart
+++ b/dev/integration_tests/flutter_gallery/lib/demo/transformations/transformations_demo_gesture_transformable.dart
@@ -392,9 +392,7 @@
 
   // Handle the start of a gesture of _GestureType.
   void _onScaleStart(ScaleStartDetails details) {
-    if (widget.onScaleStart != null) {
-      widget.onScaleStart!(details);
-    }
+    widget.onScaleStart?.call(details);
 
     if (_controller.isAnimating) {
       _controller.stop();
@@ -417,13 +415,11 @@
   // Handle an update to an ongoing gesture of _GestureType.
   void _onScaleUpdate(ScaleUpdateDetails details) {
     double scale = _transform.getMaxScaleOnAxis();
-    if (widget.onScaleUpdate != null) {
-      widget.onScaleUpdate!(ScaleUpdateDetails(
-        focalPoint: fromViewport(details.focalPoint, _transform),
-        scale: details.scale,
-        rotation: details.rotation,
-      ));
-    }
+    widget.onScaleUpdate?.call(ScaleUpdateDetails(
+      focalPoint: fromViewport(details.focalPoint, _transform),
+      scale: details.scale,
+      rotation: details.rotation,
+    ));
     final Offset focalPointScene = fromViewport(
       details.focalPoint,
       _transform,
@@ -476,9 +472,7 @@
 
   // Handle the end of a gesture of _GestureType.
   void _onScaleEnd(ScaleEndDetails details) {
-    if (widget.onScaleEnd != null) {
-      widget.onScaleEnd!(details);
-    }
+    widget.onScaleEnd?.call(details);
     setState(() {
       _scaleStart = null;
       _rotationStart = null;
diff --git a/packages/flutter/lib/src/cupertino/picker.dart b/packages/flutter/lib/src/cupertino/picker.dart
index a0c6b58..b7124d5 100644
--- a/packages/flutter/lib/src/cupertino/picker.dart
+++ b/packages/flutter/lib/src/cupertino/picker.dart
@@ -255,9 +255,7 @@
       HapticFeedback.selectionClick();
     }
 
-    if (widget.onSelectedItemChanged != null) {
-      widget.onSelectedItemChanged!(index);
-    }
+    widget.onSelectedItemChanged?.call(index);
   }
 
   /// Draws the selectionOverlay.
diff --git a/packages/flutter/lib/src/cupertino/slider.dart b/packages/flutter/lib/src/cupertino/slider.dart
index 4e6a826..71a0fcc 100644
--- a/packages/flutter/lib/src/cupertino/slider.dart
+++ b/packages/flutter/lib/src/cupertino/slider.dart
@@ -475,18 +475,14 @@
 
   void _startInteraction(Offset globalPosition) {
     if (isInteractive) {
-      if (onChangeStart != null) {
-        onChangeStart!(_discretizedCurrentDragValue);
-      }
+      onChangeStart?.call(_discretizedCurrentDragValue);
       _currentDragValue = _value;
       onChanged!(_discretizedCurrentDragValue);
     }
   }
 
   void _endInteraction() {
-    if (onChangeEnd != null) {
-      onChangeEnd!(_discretizedCurrentDragValue);
-    }
+    onChangeEnd?.call(_discretizedCurrentDragValue);
     _currentDragValue = 0.0;
   }
 
diff --git a/packages/flutter/lib/src/cupertino/text_field.dart b/packages/flutter/lib/src/cupertino/text_field.dart
index 9b58ac4..9692265 100644
--- a/packages/flutter/lib/src/cupertino/text_field.dart
+++ b/packages/flutter/lib/src/cupertino/text_field.dart
@@ -116,8 +116,7 @@
     }
     super.onSingleTapUp(details);
     _state._requestKeyboard();
-    if (_state.widget.onTap != null)
-      _state.widget.onTap!();
+    _state.widget.onTap?.call();
   }
 
   @override
diff --git a/packages/flutter/lib/src/foundation/assertions.dart b/packages/flutter/lib/src/foundation/assertions.dart
index f10da58..72d8e70 100644
--- a/packages/flutter/lib/src/foundation/assertions.dart
+++ b/packages/flutter/lib/src/foundation/assertions.dart
@@ -1104,9 +1104,7 @@
   static void reportError(FlutterErrorDetails details) {
     assert(details != null);
     assert(details.exception != null);
-    if (onError != null) {
-      onError!(details);
-    }
+    onError?.call(details);
   }
 }
 
diff --git a/packages/flutter/lib/src/material/bottom_sheet.dart b/packages/flutter/lib/src/material/bottom_sheet.dart
index 0f926ac..d02a131 100644
--- a/packages/flutter/lib/src/material/bottom_sheet.dart
+++ b/packages/flutter/lib/src/material/bottom_sheet.dart
@@ -193,9 +193,7 @@
   bool get _dismissUnderway => widget.animationController!.status == AnimationStatus.reverse;
 
   void _handleDragStart(DragStartDetails details) {
-    if (widget.onDragStart != null) {
-      widget.onDragStart!(details);
-    }
+    widget.onDragStart?.call(details);
   }
 
   void _handleDragUpdate(DragUpdateDetails details) {
@@ -226,12 +224,10 @@
       widget.animationController!.forward();
     }
 
-    if (widget.onDragEnd != null) {
-      widget.onDragEnd!(
-        details,
-        isClosing: isClosing,
-      );
-    }
+    widget.onDragEnd?.call(
+      details,
+      isClosing: isClosing,
+    );
 
     if (isClosing) {
       widget.onClosing();
diff --git a/packages/flutter/lib/src/material/button.dart b/packages/flutter/lib/src/material/button.dart
index d8a3294..8033f35 100644
--- a/packages/flutter/lib/src/material/button.dart
+++ b/packages/flutter/lib/src/material/button.dart
@@ -330,9 +330,7 @@
     if (_pressed != value) {
       setState(() {
         _updateState(MaterialState.pressed, value);
-        if (widget.onHighlightChanged != null) {
-          widget.onHighlightChanged!(value);
-        }
+        widget.onHighlightChanged?.call(value);
       });
     }
   }
diff --git a/packages/flutter/lib/src/material/dropdown.dart b/packages/flutter/lib/src/material/dropdown.dart
index c4f27e1..3f4621a 100644
--- a/packages/flutter/lib/src/material/dropdown.dart
+++ b/packages/flutter/lib/src/material/dropdown.dart
@@ -150,9 +150,7 @@
   void _handleOnTap() {
     final DropdownMenuItem<T> dropdownMenuItem = widget.route.items[widget.itemIndex].item!;
 
-    if (dropdownMenuItem.onTap != null) {
-      dropdownMenuItem.onTap!();
-    }
+    dropdownMenuItem.onTap?.call();
 
     Navigator.pop(
       context,
@@ -1270,13 +1268,10 @@
       _removeDropdownRoute();
       if (!mounted || newValue == null)
         return;
-      if (widget.onChanged != null)
-        widget.onChanged!(newValue.result);
+      widget.onChanged?.call(newValue.result);
     });
 
-    if (widget.onTap != null) {
-      widget.onTap!();
-    }
+    widget.onTap?.call();
   }
 
   // When isDense is true, reduce the height of this button from _kMenuItemHeight to
diff --git a/packages/flutter/lib/src/material/expand_icon.dart b/packages/flutter/lib/src/material/expand_icon.dart
index 1f9fba1..23e0a1f 100644
--- a/packages/flutter/lib/src/material/expand_icon.dart
+++ b/packages/flutter/lib/src/material/expand_icon.dart
@@ -137,8 +137,7 @@
   }
 
   void _handlePressed() {
-    if (widget.onPressed != null)
-      widget.onPressed!(widget.isExpanded);
+    widget.onPressed?.call(widget.isExpanded);
   }
 
   /// Default icon colors and opacities for when [Theme.brightness] is set to
diff --git a/packages/flutter/lib/src/material/expansion_panel.dart b/packages/flutter/lib/src/material/expansion_panel.dart
index bc5b340..ea9d0e3 100644
--- a/packages/flutter/lib/src/material/expansion_panel.dart
+++ b/packages/flutter/lib/src/material/expansion_panel.dart
@@ -442,8 +442,7 @@
   }
 
   void _handlePressed(bool isExpanded, int index) {
-    if (widget.expansionCallback != null)
-      widget.expansionCallback!(index, isExpanded);
+    widget.expansionCallback?.call(index, isExpanded);
 
     if (widget._allowOnlyOnePanelOpen) {
       final ExpansionPanelRadio pressedChild = widget.children[index] as ExpansionPanelRadio;
diff --git a/packages/flutter/lib/src/material/expansion_tile.dart b/packages/flutter/lib/src/material/expansion_tile.dart
index c4207e9..05c55ab 100644
--- a/packages/flutter/lib/src/material/expansion_tile.dart
+++ b/packages/flutter/lib/src/material/expansion_tile.dart
@@ -241,8 +241,7 @@
       }
       PageStorage.of(context)?.writeState(context, _isExpanded);
     });
-    if (widget.onExpansionChanged != null)
-      widget.onExpansionChanged!(_isExpanded);
+    widget.onExpansionChanged?.call(_isExpanded);
   }
 
   Widget _buildChildren(BuildContext context, Widget? child) {
diff --git a/packages/flutter/lib/src/material/material.dart b/packages/flutter/lib/src/material/material.dart
index d95b4c6..1e85a90 100644
--- a/packages/flutter/lib/src/material/material.dart
+++ b/packages/flutter/lib/src/material/material.dart
@@ -626,8 +626,7 @@
       return true;
     }());
     _controller._removeFeature(this);
-    if (onRemoved != null)
-      onRemoved!();
+    onRemoved?.call();
   }
 
   void _paint(Canvas canvas) {
diff --git a/packages/flutter/lib/src/material/popup_menu.dart b/packages/flutter/lib/src/material/popup_menu.dart
index 2ad823e..1ebc93d 100644
--- a/packages/flutter/lib/src/material/popup_menu.dart
+++ b/packages/flutter/lib/src/material/popup_menu.dart
@@ -1110,12 +1110,10 @@
         if (!mounted)
           return null;
         if (newValue == null) {
-          if (widget.onCanceled != null)
-            widget.onCanceled!();
+          widget.onCanceled?.call();
           return null;
         }
-        if (widget.onSelected != null)
-          widget.onSelected!(newValue);
+        widget.onSelected?.call(newValue);
       });
     }
   }
diff --git a/packages/flutter/lib/src/material/range_slider.dart b/packages/flutter/lib/src/material/range_slider.dart
index 508de17..213d730 100644
--- a/packages/flutter/lib/src/material/range_slider.dart
+++ b/packages/flutter/lib/src/material/range_slider.dart
@@ -1131,9 +1131,7 @@
       }
       _updateLabelPainter(_lastThumbSelection!);
 
-      if (onChangeStart != null) {
-        onChangeStart!(currentValues);
-      }
+      onChangeStart?.call(currentValues);
 
       onChanged!(_discretizeRangeValues(_newValues));
 
@@ -1202,9 +1200,7 @@
 
     if (_active && _state.mounted && _lastThumbSelection != null) {
       final RangeValues discreteValues = _discretizeRangeValues(_newValues);
-      if (onChangeEnd != null) {
-        onChangeEnd!(discreteValues);
-      }
+      onChangeEnd?.call(discreteValues);
       _active = false;
     }
     _state.overlayController.reverse();
@@ -1710,12 +1706,8 @@
 
   @override
   void paint(PaintingContext context, Offset offset) {
-    if (_state.paintBottomValueIndicator != null) {
-      _state.paintBottomValueIndicator!(context, offset);
-    }
-    if (_state.paintTopValueIndicator != null) {
-      _state.paintTopValueIndicator!(context, offset);
-    }
+    _state.paintBottomValueIndicator?.call(context, offset);
+    _state.paintTopValueIndicator?.call(context, offset);
   }
 
   @override
diff --git a/packages/flutter/lib/src/material/slider.dart b/packages/flutter/lib/src/material/slider.dart
index 7d1b4cb..2cfa277 100644
--- a/packages/flutter/lib/src/material/slider.dart
+++ b/packages/flutter/lib/src/material/slider.dart
@@ -1230,9 +1230,7 @@
       // We supply the *current* value as the start location, so that if we have
       // a tap, it consists of a call to onChangeStart with the previous value and
       // a call to onChangeEnd with the new value.
-      if (onChangeStart != null) {
-        onChangeStart!(_discretize(value));
-      }
+      onChangeStart?.call(_discretize(value));
       _currentDragValue = _getValueFromGlobalPosition(globalPosition);
       onChanged!(_discretize(_currentDragValue));
       _state.overlayController.forward();
@@ -1256,9 +1254,7 @@
     }
 
     if (_active && _state.mounted) {
-      if (onChangeEnd != null) {
-        onChangeEnd!(_discretize(_currentDragValue));
-      }
+      onChangeEnd?.call(_discretize(_currentDragValue));
       _active = false;
       _currentDragValue = 0.0;
       _state.overlayController.reverse();
@@ -1584,9 +1580,7 @@
 
   @override
   void paint(PaintingContext context, Offset offset) {
-    if (_state.paintValueIndicator != null) {
-      _state.paintValueIndicator!(context, offset);
-    }
+    _state.paintValueIndicator?.call(context, offset);
   }
 
   @override
diff --git a/packages/flutter/lib/src/material/stepper.dart b/packages/flutter/lib/src/material/stepper.dart
index 161ea1a..2e37294 100755
--- a/packages/flutter/lib/src/material/stepper.dart
+++ b/packages/flutter/lib/src/material/stepper.dart
@@ -648,8 +648,7 @@
                     duration: kThemeAnimationDuration,
                   );
 
-                  if (widget.onStepTapped != null)
-                    widget.onStepTapped!(i);
+                  widget.onStepTapped?.call(i);
                 } : null,
                 canRequestFocus: widget.steps[i].state != StepState.disabled,
                 child: _buildVerticalHeader(i),
@@ -666,8 +665,7 @@
       for (int i = 0; i < widget.steps.length; i += 1) ...<Widget>[
         InkResponse(
           onTap: widget.steps[i].state != StepState.disabled ? () {
-            if (widget.onStepTapped != null)
-              widget.onStepTapped!(i);
+            widget.onStepTapped?.call(i);
           } : null,
           canRequestFocus: widget.steps[i].state != StepState.disabled,
           child: Row(
diff --git a/packages/flutter/lib/src/material/tabs.dart b/packages/flutter/lib/src/material/tabs.dart
index 819ef2b..db64b38 100644
--- a/packages/flutter/lib/src/material/tabs.dart
+++ b/packages/flutter/lib/src/material/tabs.dart
@@ -1123,9 +1123,7 @@
   void _handleTap(int index) {
     assert(index >= 0 && index < widget.tabs.length);
     _controller!.animateTo(index);
-    if (widget.onTap != null) {
-      widget.onTap!(index);
-    }
+    widget.onTap?.call(index);
   }
 
   Widget _buildStyledTab(Widget child, bool selected, Animation<double> animation) {
diff --git a/packages/flutter/lib/src/material/text_field.dart b/packages/flutter/lib/src/material/text_field.dart
index 8b908e8..1e9dd92 100644
--- a/packages/flutter/lib/src/material/text_field.dart
+++ b/packages/flutter/lib/src/material/text_field.dart
@@ -114,8 +114,7 @@
       }
     }
     _state._requestKeyboard();
-    if (_state.widget.onTap != null)
-      _state.widget.onTap!();
+    _state.widget.onTap?.call();
   }
 
   @override
diff --git a/packages/flutter/lib/src/material/time_picker.dart b/packages/flutter/lib/src/material/time_picker.dart
index 06cd038..b6c270b 100644
--- a/packages/flutter/lib/src/material/time_picker.dart
+++ b/packages/flutter/lib/src/material/time_picker.dart
@@ -1074,9 +1074,7 @@
     _center = null;
     _animateTo(_getThetaForTime(widget.selectedTime));
     if (widget.mode == _TimePickerMode.hour) {
-      if (widget.onHourSelected != null) {
-        widget.onHourSelected!();
-      }
+      widget.onHourSelected?.call();
     }
   }
 
@@ -1092,9 +1090,7 @@
       } else {
         _announceToAccessibility(context, localizations.formatDecimal(newTime.hourOfPeriod));
       }
-      if (widget.onHourSelected != null) {
-        widget.onHourSelected!();
-      }
+      widget.onHourSelected?.call();
     } else {
       _announceToAccessibility(context, localizations.formatDecimal(newTime.minute));
     }
diff --git a/packages/flutter/lib/src/painting/decoration_image.dart b/packages/flutter/lib/src/painting/decoration_image.dart
index 64e21e6..a9cdff7 100644
--- a/packages/flutter/lib/src/painting/decoration_image.dart
+++ b/packages/flutter/lib/src/painting/decoration_image.dart
@@ -534,9 +534,7 @@
       if (existingSizeInfo == null || existingSizeInfo.displaySizeInBytes < sizeInfo.displaySizeInBytes) {
         _pendingImageSizeInfo[sizeInfo.source!] = sizeInfo;
       }
-      if (debugOnPaintImage != null) {
-        debugOnPaintImage!(sizeInfo);
-      }
+      debugOnPaintImage?.call(sizeInfo);
       SchedulerBinding.instance!.addPostFrameCallback((Duration timeStamp) {
         _lastFrameImageSizeInfo = _pendingImageSizeInfo.values.toSet();
         if (_pendingImageSizeInfo.isEmpty) {
diff --git a/packages/flutter/lib/src/rendering/editable.dart b/packages/flutter/lib/src/rendering/editable.dart
index 86c3ed2..21f8a5a 100644
--- a/packages/flutter/lib/src/rendering/editable.dart
+++ b/packages/flutter/lib/src/rendering/editable.dart
@@ -598,9 +598,7 @@
     if (nextSelection == selection && cause != SelectionChangedCause.keyboard && !focusingEmpty) {
       return;
     }
-    if (onSelectionChanged != null) {
-      onSelectionChanged!(nextSelection, this, cause);
-    }
+    onSelectionChanged?.call(nextSelection, this, cause);
   }
 
   static final Set<LogicalKeyboardKey> _movementKeys = <LogicalKeyboardKey>{
diff --git a/packages/flutter/lib/src/rendering/proxy_box.dart b/packages/flutter/lib/src/rendering/proxy_box.dart
index f29f20e..a23ed45 100644
--- a/packages/flutter/lib/src/rendering/proxy_box.dart
+++ b/packages/flutter/lib/src/rendering/proxy_box.dart
@@ -4760,103 +4760,83 @@
   }
 
   void _performTap() {
-    if (onTap != null)
-      onTap!();
+    onTap?.call();
   }
 
   void _performLongPress() {
-    if (onLongPress != null)
-      onLongPress!();
+    onLongPress?.call();
   }
 
   void _performDismiss() {
-    if (onDismiss != null)
-      onDismiss!();
+    onDismiss?.call();
   }
 
   void _performScrollLeft() {
-    if (onScrollLeft != null)
-      onScrollLeft!();
+    onScrollLeft?.call();
   }
 
   void _performScrollRight() {
-    if (onScrollRight != null)
-      onScrollRight!();
+    onScrollRight?.call();
   }
 
   void _performScrollUp() {
-    if (onScrollUp != null)
-      onScrollUp!();
+    onScrollUp?.call();
   }
 
   void _performScrollDown() {
-    if (onScrollDown != null)
-      onScrollDown!();
+    onScrollDown?.call();
   }
 
   void _performIncrease() {
-    if (onIncrease != null)
-      onIncrease!();
+    onIncrease?.call();
   }
 
   void _performDecrease() {
-    if (onDecrease != null)
-      onDecrease!();
+    onDecrease?.call();
   }
 
   void _performCopy() {
-    if (onCopy != null)
-      onCopy!();
+    onCopy?.call();
   }
 
   void _performCut() {
-    if (onCut != null)
-      onCut!();
+    onCut?.call();
   }
 
   void _performPaste() {
-    if (onPaste != null)
-      onPaste!();
+    onPaste?.call();
   }
 
   void _performMoveCursorForwardByCharacter(bool extendSelection) {
-    if (onMoveCursorForwardByCharacter != null)
-      onMoveCursorForwardByCharacter!(extendSelection);
+    onMoveCursorForwardByCharacter?.call(extendSelection);
   }
 
   void _performMoveCursorBackwardByCharacter(bool extendSelection) {
-    if (onMoveCursorBackwardByCharacter != null)
-      onMoveCursorBackwardByCharacter!(extendSelection);
+    onMoveCursorBackwardByCharacter?.call(extendSelection);
   }
 
   void _performMoveCursorForwardByWord(bool extendSelection) {
-    if (onMoveCursorForwardByWord != null)
-      onMoveCursorForwardByWord!(extendSelection);
+    onMoveCursorForwardByWord?.call(extendSelection);
   }
 
   void _performMoveCursorBackwardByWord(bool extendSelection) {
-    if (onMoveCursorBackwardByWord != null)
-      onMoveCursorBackwardByWord!(extendSelection);
+    onMoveCursorBackwardByWord?.call(extendSelection);
   }
 
   void _performSetSelection(TextSelection selection) {
-    if (onSetSelection != null)
-      onSetSelection!(selection);
+    onSetSelection?.call(selection);
   }
 
   void _performSetText(String text) {
-    if (onSetText != null)
-      onSetText!(text);
+    onSetText?.call(text);
   }
 
   void _performDidGainAccessibilityFocus() {
-    if (onDidGainAccessibilityFocus != null)
-      onDidGainAccessibilityFocus!();
+    onDidGainAccessibilityFocus?.call();
   }
 
   void _performDidLoseAccessibilityFocus() {
-    if (onDidLoseAccessibilityFocus != null)
-      onDidLoseAccessibilityFocus!();
+    onDidLoseAccessibilityFocus?.call();
   }
 }
 
diff --git a/packages/flutter/lib/src/widgets/basic.dart b/packages/flutter/lib/src/widgets/basic.dart
index 0675e49..26cc500 100644
--- a/packages/flutter/lib/src/widgets/basic.dart
+++ b/packages/flutter/lib/src/widgets/basic.dart
@@ -6178,8 +6178,7 @@
 
   @override
   void updateRenderObject(BuildContext context, RenderBox renderObject) {
-    if (onBuild != null)
-      onBuild!();
+    onBuild?.call();
   }
 }
 
diff --git a/packages/flutter/lib/src/widgets/dismissible.dart b/packages/flutter/lib/src/widgets/dismissible.dart
index bfc5662..5ce3aac 100644
--- a/packages/flutter/lib/src/widgets/dismissible.dart
+++ b/packages/flutter/lib/src/widgets/dismissible.dart
@@ -543,13 +543,9 @@
 
   void _handleResizeProgressChanged() {
     if (_resizeController!.isCompleted) {
-      if (widget.onDismissed != null) {
-        final DismissDirection direction = _dismissDirection;
-        widget.onDismissed!(direction);
-      }
+      widget.onDismissed?.call(_dismissDirection);
     } else {
-      if (widget.onResize != null)
-        widget.onResize!();
+      widget.onResize?.call();
     }
   }
 
diff --git a/packages/flutter/lib/src/widgets/drag_target.dart b/packages/flutter/lib/src/widgets/drag_target.dart
index 22e7e55..b5f35d1 100644
--- a/packages/flutter/lib/src/widgets/drag_target.dart
+++ b/packages/flutter/lib/src/widgets/drag_target.dart
@@ -576,8 +576,7 @@
           widget.onDraggableCanceled!(velocity, offset);
       },
     );
-    if (widget.onDragStarted != null)
-      widget.onDragStarted!();
+    widget.onDragStarted?.call();
     return avatar;
   }
 
@@ -754,8 +753,7 @@
       _candidateAvatars.remove(avatar);
       _rejectedAvatars.remove(avatar);
     });
-    if (widget.onLeave != null)
-      widget.onLeave!(avatar.data as T?);
+    widget.onLeave?.call(avatar.data as T?);
   }
 
   void didDrop(_DragAvatar<Object> avatar) {
@@ -765,17 +763,14 @@
     setState(() {
       _candidateAvatars.remove(avatar);
     });
-    if (widget.onAccept != null)
-      widget.onAccept!(avatar.data! as T);
-    if (widget.onAcceptWithDetails != null)
-      widget.onAcceptWithDetails!(DragTargetDetails<T>(data: avatar.data! as T, offset: avatar._lastOffset!));
+    widget.onAccept?.call(avatar.data! as T);
+    widget.onAcceptWithDetails?.call(DragTargetDetails<T>(data: avatar.data! as T, offset: avatar._lastOffset!));
   }
 
   void didMove(_DragAvatar<Object> avatar) {
     if (!mounted)
       return;
-    if (widget.onMove != null)
-      widget.onMove!(DragTargetDetails<T>(data: avatar.data! as T, offset: avatar._lastOffset!));
+    widget.onMove?.call(DragTargetDetails<T>(data: avatar.data! as T, offset: avatar._lastOffset!));
   }
 
   @override
@@ -937,8 +932,7 @@
     _entry!.remove();
     _entry = null;
     // TODO(ianh): consider passing _entry as well so the client can perform an animation.
-    if (onDragEnd != null)
-      onDragEnd!(velocity ?? Velocity.zero, _lastOffset!, wasAccepted);
+    onDragEnd?.call(velocity ?? Velocity.zero, _lastOffset!, wasAccepted);
   }
 
   Widget _build(BuildContext context) {
diff --git a/packages/flutter/lib/src/widgets/focus_scope.dart b/packages/flutter/lib/src/widgets/focus_scope.dart
index 3ca2358..55b4354 100644
--- a/packages/flutter/lib/src/widgets/focus_scope.dart
+++ b/packages/flutter/lib/src/widgets/focus_scope.dart
@@ -670,9 +670,7 @@
     final bool hasPrimaryFocus = focusNode.hasPrimaryFocus;
     final bool canRequestFocus = focusNode.canRequestFocus;
     final bool descendantsAreFocusable = focusNode.descendantsAreFocusable;
-    if (widget.onFocusChange != null) {
-      widget.onFocusChange!(focusNode.hasFocus);
-    }
+    widget.onFocusChange?.call(focusNode.hasFocus);
     if (_hasPrimaryFocus != hasPrimaryFocus) {
       setState(() {
         _hasPrimaryFocus = hasPrimaryFocus;
diff --git a/packages/flutter/lib/src/widgets/form.dart b/packages/flutter/lib/src/widgets/form.dart
index f8af252..b0ef599 100644
--- a/packages/flutter/lib/src/widgets/form.dart
+++ b/packages/flutter/lib/src/widgets/form.dart
@@ -167,9 +167,7 @@
   // Called when a form field has changed. This will cause all form fields
   // to rebuild, useful if form fields have interdependencies.
   void _fieldDidChange() {
-    if (widget.onChanged != null)
-      widget.onChanged!();
-
+    widget.onChanged?.call();
 
     _hasInteractedByUser = _fields
         .any((FormFieldState<dynamic> field) => field._hasInteractedByUser);
@@ -435,8 +433,7 @@
 
   /// Calls the [FormField]'s onSaved method with the current value.
   void save() {
-    if (widget.onSaved != null)
-      widget.onSaved!(value);
+    widget.onSaved?.call(value);
   }
 
   /// Resets the field to its initial value.
diff --git a/packages/flutter/lib/src/widgets/framework.dart b/packages/flutter/lib/src/widgets/framework.dart
index 313ab39..d3b343c 100644
--- a/packages/flutter/lib/src/widgets/framework.dart
+++ b/packages/flutter/lib/src/widgets/framework.dart
@@ -4241,9 +4241,7 @@
     if (_lifecycleState != _ElementLifecycle.active || !_dirty)
       return;
     assert(() {
-      if (debugOnRebuildDirtyWidget != null) {
-        debugOnRebuildDirtyWidget!(this, _debugBuiltOnce);
-      }
+      debugOnRebuildDirtyWidget?.call(this, _debugBuiltOnce);
       if (debugPrintRebuildDirtyWidgets) {
         if (!_debugBuiltOnce) {
           debugPrint('Building $this');
diff --git a/packages/flutter/lib/src/widgets/gesture_detector.dart b/packages/flutter/lib/src/widgets/gesture_detector.dart
index a5756d4..d6425d7 100644
--- a/packages/flutter/lib/src/widgets/gesture_detector.dart
+++ b/packages/flutter/lib/src/widgets/gesture_detector.dart
@@ -1332,12 +1332,9 @@
 
     return () {
       assert(tap != null);
-      if (tap.onTapDown != null)
-        tap.onTapDown!(TapDownDetails());
-      if (tap.onTapUp != null)
-        tap.onTapUp!(TapUpDetails(kind: PointerDeviceKind.unknown));
-      if (tap.onTap != null)
-        tap.onTap!();
+      tap.onTapDown?.call(TapDownDetails());
+      tap.onTapUp?.call(TapUpDetails(kind: PointerDeviceKind.unknown));
+      tap.onTap?.call();
     };
   }
 
@@ -1347,14 +1344,10 @@
       return null;
 
     return () {
-      if (longPress.onLongPressStart != null)
-        longPress.onLongPressStart!(const LongPressStartDetails());
-      if (longPress.onLongPress != null)
-        longPress.onLongPress!();
-      if (longPress.onLongPressEnd != null)
-        longPress.onLongPressEnd!(const LongPressEndDetails());
-      if (longPress.onLongPressUp != null)
-        longPress.onLongPressUp!();
+      longPress.onLongPressStart?.call(const LongPressStartDetails());
+      longPress.onLongPress?.call();
+      longPress.onLongPressEnd?.call(const LongPressEndDetails());
+      longPress.onLongPressUp?.call();
     };
   }
 
@@ -1365,27 +1358,19 @@
     final GestureDragUpdateCallback? horizontalHandler = horizontal == null ?
       null :
       (DragUpdateDetails details) {
-        if (horizontal.onDown != null)
-          horizontal.onDown!(DragDownDetails());
-        if (horizontal.onStart != null)
-          horizontal.onStart!(DragStartDetails());
-        if (horizontal.onUpdate != null)
-          horizontal.onUpdate!(details);
-        if (horizontal.onEnd != null)
-          horizontal.onEnd!(DragEndDetails(primaryVelocity: 0.0));
+        horizontal.onDown?.call(DragDownDetails());
+        horizontal.onStart?.call(DragStartDetails());
+        horizontal.onUpdate?.call(details);
+        horizontal.onEnd?.call(DragEndDetails(primaryVelocity: 0.0));
       };
 
     final GestureDragUpdateCallback? panHandler = pan == null ?
       null :
       (DragUpdateDetails details) {
-        if (pan.onDown != null)
-          pan.onDown!(DragDownDetails());
-        if (pan.onStart != null)
-          pan.onStart!(DragStartDetails());
-        if (pan.onUpdate != null)
-          pan.onUpdate!(details);
-        if (pan.onEnd != null)
-          pan.onEnd!(DragEndDetails());
+        pan.onDown?.call(DragDownDetails());
+        pan.onStart?.call(DragStartDetails());
+        pan.onUpdate?.call(details);
+        pan.onEnd?.call(DragEndDetails());
       };
 
     if (horizontalHandler == null && panHandler == null)
@@ -1405,27 +1390,19 @@
     final GestureDragUpdateCallback? verticalHandler = vertical == null ?
       null :
       (DragUpdateDetails details) {
-        if (vertical.onDown != null)
-          vertical.onDown!(DragDownDetails());
-        if (vertical.onStart != null)
-          vertical.onStart!(DragStartDetails());
-        if (vertical.onUpdate != null)
-          vertical.onUpdate!(details);
-        if (vertical.onEnd != null)
-          vertical.onEnd!(DragEndDetails(primaryVelocity: 0.0));
+        vertical.onDown?.call(DragDownDetails());
+        vertical.onStart?.call(DragStartDetails());
+        vertical.onUpdate?.call(details);
+        vertical.onEnd?.call(DragEndDetails(primaryVelocity: 0.0));
       };
 
     final GestureDragUpdateCallback? panHandler = pan == null ?
       null :
       (DragUpdateDetails details) {
-        if (pan.onDown != null)
-          pan.onDown!(DragDownDetails());
-        if (pan.onStart != null)
-          pan.onStart!(DragStartDetails());
-        if (pan.onUpdate != null)
-          pan.onUpdate!(details);
-        if (pan.onEnd != null)
-          pan.onEnd!(DragEndDetails());
+        pan.onDown?.call(DragDownDetails());
+        pan.onStart?.call(DragStartDetails());
+        pan.onUpdate?.call(details);
+        pan.onEnd?.call(DragEndDetails());
       };
 
     if (verticalHandler == null && panHandler == null)
diff --git a/packages/flutter/lib/src/widgets/implicit_animations.dart b/packages/flutter/lib/src/widgets/implicit_animations.dart
index 263c5ea..84c9fe2 100644
--- a/packages/flutter/lib/src/widgets/implicit_animations.dart
+++ b/packages/flutter/lib/src/widgets/implicit_animations.dart
@@ -370,8 +370,7 @@
     _controller.addStatusListener((AnimationStatus status) {
       switch (status) {
         case AnimationStatus.completed:
-          if (widget.onEnd != null)
-            widget.onEnd!();
+          widget.onEnd?.call();
           break;
         case AnimationStatus.dismissed:
         case AnimationStatus.forward:
diff --git a/packages/flutter/lib/src/widgets/modal_barrier.dart b/packages/flutter/lib/src/widgets/modal_barrier.dart
index 527a53f..fea4a7c 100644
--- a/packages/flutter/lib/src/widgets/modal_barrier.dart
+++ b/packages/flutter/lib/src/widgets/modal_barrier.dart
@@ -228,8 +228,7 @@
   @protected
   @override
   void handleTapUp({PointerDownEvent? down, PointerUpEvent? up}) {
-    if (onAnyTapUp != null)
-      onAnyTapUp!();
+    onAnyTapUp?.call();
   }
 
   @protected
diff --git a/packages/flutter/lib/src/widgets/navigator.dart b/packages/flutter/lib/src/widgets/navigator.dart
index f88d407..d6fabc6 100644
--- a/packages/flutter/lib/src/widgets/navigator.dart
+++ b/packages/flutter/lib/src/widgets/navigator.dart
@@ -5968,9 +5968,7 @@
       _route?.restorationScopeId.removeListener(notifyListeners);
       _route = null;
       notifyListeners();
-      if (onComplete != null) {
-        onComplete!(result as T);
-      }
+      onComplete?.call(result as T);
     });
   }
 
diff --git a/packages/flutter/lib/src/widgets/platform_view.dart b/packages/flutter/lib/src/widgets/platform_view.dart
index f45f063..a9e9856 100644
--- a/packages/flutter/lib/src/widgets/platform_view.dart
+++ b/packages/flutter/lib/src/widgets/platform_view.dart
@@ -638,9 +638,7 @@
       controller.dispose();
       return;
     }
-    if (widget.onPlatformViewCreated != null) {
-      widget.onPlatformViewCreated!(id);
-    }
+    widget.onPlatformViewCreated?.call(id);
     setState(() { _controller = controller; });
   }
 }
diff --git a/packages/flutter/lib/src/widgets/raw_keyboard_listener.dart b/packages/flutter/lib/src/widgets/raw_keyboard_listener.dart
index 3c7cdeb..58d49a4 100644
--- a/packages/flutter/lib/src/widgets/raw_keyboard_listener.dart
+++ b/packages/flutter/lib/src/widgets/raw_keyboard_listener.dart
@@ -121,8 +121,7 @@
   }
 
   void _handleRawKeyEvent(RawKeyEvent event) {
-    if (widget.onKey != null)
-      widget.onKey!(event);
+    widget.onKey?.call(event);
   }
 
   @override
diff --git a/packages/flutter/lib/src/widgets/routes.dart b/packages/flutter/lib/src/widgets/routes.dart
index b9f3c55..aa5ac7a 100644
--- a/packages/flutter/lib/src/widgets/routes.dart
+++ b/packages/flutter/lib/src/widgets/routes.dart
@@ -445,8 +445,7 @@
   }
 
   void _notifyRemoved() {
-    if (onRemove != null)
-      onRemove!();
+    onRemove?.call();
   }
 }
 
diff --git a/packages/flutter/lib/src/widgets/scroll_activity.dart b/packages/flutter/lib/src/widgets/scroll_activity.dart
index 2cd116b..5aee86a 100644
--- a/packages/flutter/lib/src/widgets/scroll_activity.dart
+++ b/packages/flutter/lib/src/widgets/scroll_activity.dart
@@ -214,8 +214,7 @@
 
   @override
   void dispose() {
-    if (onHoldCanceled != null)
-      onHoldCanceled!();
+    onHoldCanceled?.call();
     super.dispose();
   }
 }
@@ -406,8 +405,7 @@
   @mustCallSuper
   void dispose() {
     _lastDetails = null;
-    if (onDragCanceled != null)
-      onDragCanceled!();
+    onDragCanceled?.call();
   }
 
   /// The most recently observed [DragStartDetails], [DragUpdateDetails], or
diff --git a/packages/flutter/lib/src/widgets/text_selection.dart b/packages/flutter/lib/src/widgets/text_selection.dart
index 15783a7..dff2337 100644
--- a/packages/flutter/lib/src/widgets/text_selection.dart
+++ b/packages/flutter/lib/src/widgets/text_selection.dart
@@ -782,8 +782,7 @@
   }
 
   void _handleTap() {
-    if (widget.onSelectionHandleTapped != null)
-      widget.onSelectionHandleTapped!();
+    widget.onSelectionHandleTapped?.call();
   }
 
   @override
@@ -1386,9 +1385,7 @@
   // The down handler is force-run on success of a single tap and optimistically
   // run before a long press success.
   void _handleTapDown(TapDownDetails details) {
-    if (widget.onTapDown != null) {
-      widget.onTapDown!(details);
-    }
+    widget.onTapDown?.call(details);
     // This isn't detected as a double tap gesture in the gesture recognizer
     // because it's 2 single taps, each of which may do different things depending
     // on whether it's a single tap, the first tap of a double tap, the second
@@ -1396,9 +1393,7 @@
     if (_doubleTapTimer != null && _isWithinDoubleTapTolerance(details.globalPosition)) {
       // If there was already a previous tap, the second down hold/tap is a
       // double tap down.
-      if (widget.onDoubleTapDown != null) {
-        widget.onDoubleTapDown!(details);
-      }
+      widget.onDoubleTapDown?.call(details);
 
       _doubleTapTimer!.cancel();
       _doubleTapTimeout();
@@ -1408,9 +1403,7 @@
 
   void _handleTapUp(TapUpDetails details) {
     if (!_isDoubleTap) {
-      if (widget.onSingleTapUp != null) {
-        widget.onSingleTapUp!(details);
-      }
+      widget.onSingleTapUp?.call(details);
       _lastTapOffset = details.globalPosition;
       _doubleTapTimer = Timer(kDoubleTapTimeout, _doubleTapTimeout);
     }
@@ -1418,9 +1411,7 @@
   }
 
   void _handleTapCancel() {
-    if (widget.onSingleTapCancel != null) {
-      widget.onSingleTapCancel!();
-    }
+    widget.onSingleTapCancel?.call();
   }
 
   DragStartDetails? _lastDragStartDetails;
@@ -1430,9 +1421,7 @@
   void _handleDragStart(DragStartDetails details) {
     assert(_lastDragStartDetails == null);
     _lastDragStartDetails = details;
-    if (widget.onDragSelectionStart != null) {
-      widget.onDragSelectionStart!(details);
-    }
+    widget.onDragSelectionStart?.call(details);
   }
 
   void _handleDragUpdate(DragUpdateDetails details) {
@@ -1450,9 +1439,7 @@
   void _handleDragUpdateThrottled() {
     assert(_lastDragStartDetails != null);
     assert(_lastDragUpdateDetails != null);
-    if (widget.onDragSelectionUpdate != null) {
-      widget.onDragSelectionUpdate!(_lastDragStartDetails!, _lastDragUpdateDetails!);
-    }
+    widget.onDragSelectionUpdate?.call(_lastDragStartDetails!, _lastDragUpdateDetails!);
     _dragUpdateThrottleTimer = null;
     _lastDragUpdateDetails = null;
   }
@@ -1465,9 +1452,7 @@
       _dragUpdateThrottleTimer!.cancel();
       _handleDragUpdateThrottled();
     }
-    if (widget.onDragSelectionEnd != null) {
-      widget.onDragSelectionEnd!(details);
-    }
+    widget.onDragSelectionEnd?.call(details);
     _dragUpdateThrottleTimer = null;
     _lastDragStartDetails = null;
     _lastDragUpdateDetails = null;
@@ -1476,13 +1461,11 @@
   void _forcePressStarted(ForcePressDetails details) {
     _doubleTapTimer?.cancel();
     _doubleTapTimer = null;
-    if (widget.onForcePressStart != null)
-      widget.onForcePressStart!(details);
+    widget.onForcePressStart?.call(details);
   }
 
   void _forcePressEnded(ForcePressDetails details) {
-    if (widget.onForcePressEnd != null)
-      widget.onForcePressEnd!(details);
+    widget.onForcePressEnd?.call(details);
   }
 
   void _handleLongPressStart(LongPressStartDetails details) {
diff --git a/packages/flutter/test/gestures/team_test.dart b/packages/flutter/test/gestures/team_test.dart
index 1fa86ee..8534ea0 100644
--- a/packages/flutter/test/gestures/team_test.dart
+++ b/packages/flutter/test/gestures/team_test.dart
@@ -130,9 +130,7 @@
 
   @override
   void acceptGesture(int pointer) {
-    if (onGestureAccepted != null) {
-      onGestureAccepted!();
-    }
+    onGestureAccepted?.call();
   }
 
   @override
diff --git a/packages/flutter/test/rendering/mouse_tracker_test_utils.dart b/packages/flutter/test/rendering/mouse_tracker_test_utils.dart
index 783a1be..346f3df 100644
--- a/packages/flutter/test/rendering/mouse_tracker_test_utils.dart
+++ b/packages/flutter/test/rendering/mouse_tracker_test_utils.dart
@@ -89,8 +89,7 @@
   @override
   void handleEvent(PointerEvent event, HitTestEntry entry) {
     if (event is PointerHoverEvent)
-      if (onHover != null)
-        onHover!(event);
+      onHover?.call(event);
   }
 }
 
diff --git a/packages/flutter/test/widgets/image_filter_quality_test.dart b/packages/flutter/test/widgets/image_filter_quality_test.dart
index 5664ba4..ba1e437 100644
--- a/packages/flutter/test/widgets/image_filter_quality_test.dart
+++ b/packages/flutter/test/widgets/image_filter_quality_test.dart
@@ -111,9 +111,7 @@
   }) {
     final List<ImageStreamListener> localListeners = listeners.toList();
     for (final ImageStreamListener listener in localListeners) {
-      if (listener.onError != null) {
-        listener.onError!(exception, stackTrace);
-      }
+      listener.onError?.call(exception, stackTrace);
     }
   }
 }
diff --git a/packages/flutter/test/widgets/image_test.dart b/packages/flutter/test/widgets/image_test.dart
index e0b4505..ea86c2b 100644
--- a/packages/flutter/test/widgets/image_test.dart
+++ b/packages/flutter/test/widgets/image_test.dart
@@ -2026,9 +2026,7 @@
   }) {
     final List<ImageStreamListener> localListeners = listeners.toList();
     for (final ImageStreamListener listener in localListeners) {
-      if (listener.onError != null) {
-        listener.onError!(exception, stackTrace);
-      }
+      listener.onError?.call(exception, stackTrace);
     }
   }
 }
diff --git a/packages/flutter/test/widgets/independent_widget_layout_test.dart b/packages/flutter/test/widgets/independent_widget_layout_test.dart
index fb15652..44c1601 100644
--- a/packages/flutter/test/widgets/independent_widget_layout_test.dart
+++ b/packages/flutter/test/widgets/independent_widget_layout_test.dart
@@ -86,8 +86,7 @@
 class Trigger {
   VoidCallback? callback;
   void fire() {
-    if (callback != null)
-      callback!();
+    callback?.call();
   }
 }
 
diff --git a/packages/flutter/test/widgets/mouse_region_test.dart b/packages/flutter/test/widgets/mouse_region_test.dart
index 121dafb..d039f9b 100644
--- a/packages/flutter/test/widgets/mouse_region_test.dart
+++ b/packages/flutter/test/widgets/mouse_region_test.dart
@@ -29,21 +29,13 @@
 
 class HoverClientState extends State<HoverClient> {
   void _onExit(PointerExitEvent details) {
-    if (widget.onExit != null) {
-      widget.onExit!();
-    }
-    if (widget.onHover != null) {
-      widget.onHover!(false);
-    }
+    widget.onExit?.call();
+    widget.onHover?.call(false);
   }
 
   void _onEnter(PointerEnterEvent details) {
-    if (widget.onEnter != null) {
-      widget.onEnter!();
-    }
-    if (widget.onHover != null) {
-      widget.onHover!(true);
-    }
+    widget.onEnter?.call();
+    widget.onHover?.call(true);
   }
 
   @override
diff --git a/packages/flutter/test/widgets/navigator_test.dart b/packages/flutter/test/widgets/navigator_test.dart
index 20f503c..8839ba1 100644
--- a/packages/flutter/test/widgets/navigator_test.dart
+++ b/packages/flutter/test/widgets/navigator_test.dart
@@ -3587,22 +3587,19 @@
   @override
   void didChangeNext(Route<dynamic>? nextRoute) {
     super.didChangeNext(nextRoute);
-    if (onDidChangeNext != null)
-      onDidChangeNext!(nextRoute);
+    onDidChangeNext?.call(nextRoute);
   }
 
   @override
   void didChangePrevious(Route<dynamic>? previousRoute) {
     super.didChangePrevious(previousRoute);
-    if (onDidChangePrevious != null)
-      onDidChangePrevious!(previousRoute);
+    onDidChangePrevious?.call(previousRoute);
   }
 
   @override
   void didPopNext(Route<dynamic> nextRoute) {
     super.didPopNext(nextRoute);
-    if (onDidPopNext != null)
-      onDidPopNext!(nextRoute);
+    onDidPopNext?.call(nextRoute);
   }
 }
 
@@ -3728,9 +3725,7 @@
   OnObservation? onPushed;
   @override
   void didPush(Route<dynamic>? route, Route<dynamic>? previousRoute) {
-    if (onPushed != null) {
-      onPushed!(route, previousRoute);
-    }
+    onPushed?.call(route, previousRoute);
   }
 }
 
diff --git a/packages/flutter/test/widgets/observer_tester.dart b/packages/flutter/test/widgets/observer_tester.dart
index f2ccbf8..e26e0bf 100644
--- a/packages/flutter/test/widgets/observer_tester.dart
+++ b/packages/flutter/test/widgets/observer_tester.dart
@@ -16,33 +16,26 @@
 
   @override
   void didPush(Route<dynamic> route, Route<dynamic>? previousRoute) {
-    if (onPushed != null) {
-      onPushed!(route, previousRoute);
-    }
+    onPushed?.call(route, previousRoute);
   }
 
   @override
   void didPop(Route<dynamic> route, Route<dynamic>? previousRoute) {
-    if (onPopped != null) {
-      onPopped!(route, previousRoute);
-    }
+    onPopped?.call(route, previousRoute);
   }
 
   @override
   void didRemove(Route<dynamic> route, Route<dynamic>? previousRoute) {
-    if (onRemoved != null)
-      onRemoved!(route, previousRoute);
+    onRemoved?.call(route, previousRoute);
   }
 
   @override
   void didReplace({ Route<dynamic>? oldRoute, Route<dynamic>? newRoute }) {
-    if (onReplaced != null)
-      onReplaced!(newRoute, oldRoute);
+    onReplaced?.call(newRoute, oldRoute);
   }
 
   @override
   void didStartUserGesture(Route<dynamic> route, Route<dynamic>? previousRoute) {
-    if (onStartUserGesture != null)
-      onStartUserGesture!(route, previousRoute);
+    onStartUserGesture?.call(route, previousRoute);
   }
 }
diff --git a/packages/flutter_test/lib/src/test_text_input.dart b/packages/flutter_test/lib/src/test_text_input.dart
index 1ae2be9..aedf388 100644
--- a/packages/flutter_test/lib/src/test_text_input.dart
+++ b/packages/flutter_test/lib/src/test_text_input.dart
@@ -102,8 +102,7 @@
       case 'TextInput.clearClient':
         _client = 0;
         _isVisible = false;
-        if (onCleared != null)
-          onCleared!();
+        onCleared?.call();
         break;
       case 'TextInput.setEditingState':
         editingState = methodCall.arguments as Map<String, dynamic>;