diff --git a/packages/flutter/lib/src/material/animated_icons/animated_icons.dart b/packages/flutter/lib/src/material/animated_icons/animated_icons.dart
index 3cff0a9..4c7d9b1 100644
--- a/packages/flutter/lib/src/material/animated_icons/animated_icons.dart
+++ b/packages/flutter/lib/src/material/animated_icons/animated_icons.dart
@@ -104,7 +104,7 @@
 
   @override
   Widget build(BuildContext context) {
-    final _AnimatedIconData iconData = icon;
+    final _AnimatedIconData iconData = icon as _AnimatedIconData;
     final IconThemeData iconTheme = IconTheme.of(context);
     final double iconSize = size ?? iconTheme.size;
     final TextDirection textDirection = this.textDirection ?? Directionality.of(context);
@@ -161,7 +161,7 @@
       canvas.translate(-size.width, -size.height);
     }
 
-    final double clampedProgress = progress.value.clamp(0.0, 1.0);
+    final double clampedProgress = progress.value.clamp(0.0, 1.0) as double;
     for (_PathFrames path in paths)
       path.paint(canvas, color, uiPathFactory, clampedProgress);
   }
diff --git a/packages/flutter/lib/src/material/app_bar.dart b/packages/flutter/lib/src/material/app_bar.dart
index 51e4967..72b8f25 100644
--- a/packages/flutter/lib/src/material/app_bar.dart
+++ b/packages/flutter/lib/src/material/app_bar.dart
@@ -750,7 +750,7 @@
     //    1   |    1     |        0       ||  1.0
     //    1   |    1     |        1       ||  fade
     final double toolbarOpacity = !pinned || (floating && bottom != null)
-      ? ((visibleMainHeight - _bottomHeight) / kToolbarHeight).clamp(0.0, 1.0)
+      ? ((visibleMainHeight - _bottomHeight) / kToolbarHeight).clamp(0.0, 1.0) as double
       : 1.0;
 
     final Widget appBar = FlexibleSpaceBar.createSettings(
@@ -778,7 +778,7 @@
         titleSpacing: titleSpacing,
         shape: shape,
         toolbarOpacity: toolbarOpacity,
-        bottomOpacity: pinned ? 1.0 : (visibleMainHeight / _bottomHeight).clamp(0.0, 1.0),
+        bottomOpacity: pinned ? 1.0 : ((visibleMainHeight / _bottomHeight).clamp(0.0, 1.0) as double),
       ),
     );
     return floating ? _FloatingAppBar(child: appBar) : appBar;
diff --git a/packages/flutter/lib/src/material/app_bar_theme.dart b/packages/flutter/lib/src/material/app_bar_theme.dart
index e1e5ff5..e9cb2b7 100644
--- a/packages/flutter/lib/src/material/app_bar_theme.dart
+++ b/packages/flutter/lib/src/material/app_bar_theme.dart
@@ -128,13 +128,13 @@
       return true;
     if (other.runtimeType != runtimeType)
       return false;
-    final AppBarTheme typedOther = other;
-    return typedOther.brightness == brightness
-        && typedOther.color == color
-        && typedOther.elevation == elevation
-        && typedOther.iconTheme == iconTheme
-        && typedOther.actionsIconTheme == actionsIconTheme
-        && typedOther.textTheme == textTheme;
+    return other is AppBarTheme
+        && other.brightness == brightness
+        && other.color == color
+        && other.elevation == elevation
+        && other.iconTheme == iconTheme
+        && other.actionsIconTheme == actionsIconTheme
+        && other.textTheme == textTheme;
   }
 
   @override
diff --git a/packages/flutter/lib/src/material/arc.dart b/packages/flutter/lib/src/material/arc.dart
index 3079556..b6bf4ab 100644
--- a/packages/flutter/lib/src/material/arc.dart
+++ b/packages/flutter/lib/src/material/arc.dart
@@ -193,14 +193,14 @@
   _Diagonal(_CornerId.bottomLeft, _CornerId.topRight),
 ];
 
-typedef _KeyFunc<T> = dynamic Function(T input);
+typedef _KeyFunc<T> = double Function(T input);
 
 // Select the element for which the key function returns the maximum value.
 T _maxBy<T>(Iterable<T> input, _KeyFunc<T> keyFunc) {
   T maxValue;
-  dynamic maxKey;
+  double maxKey;
   for (T value in input) {
-    final dynamic key = keyFunc(value);
+    final double key = keyFunc(value);
     if (maxKey == null || key > maxKey) {
       maxValue = value;
       maxKey = key;
diff --git a/packages/flutter/lib/src/material/banner_theme.dart b/packages/flutter/lib/src/material/banner_theme.dart
index 1e2e4b4..9fea036 100644
--- a/packages/flutter/lib/src/material/banner_theme.dart
+++ b/packages/flutter/lib/src/material/banner_theme.dart
@@ -73,8 +73,8 @@
     return MaterialBannerThemeData(
       backgroundColor: Color.lerp(a?.backgroundColor, b?.backgroundColor, t),
       contentTextStyle: TextStyle.lerp(a?.contentTextStyle, b?.contentTextStyle, t),
-      padding: EdgeInsets.lerp(a?.padding, b?.padding, t),
-      leadingPadding: EdgeInsets.lerp(a?.leadingPadding, b?.leadingPadding, t),
+      padding: EdgeInsetsGeometry.lerp(a?.padding, b?.padding, t),
+      leadingPadding: EdgeInsetsGeometry.lerp(a?.leadingPadding, b?.leadingPadding, t),
     );
   }
 
@@ -94,11 +94,11 @@
       return true;
     if (other.runtimeType != runtimeType)
       return false;
-    final MaterialBannerThemeData typedOther = other;
-    return typedOther.backgroundColor == backgroundColor
-        && typedOther.contentTextStyle == contentTextStyle
-        && typedOther.padding == padding
-        && typedOther.leadingPadding == leadingPadding;
+    return other is MaterialBannerThemeData
+        && other.backgroundColor == backgroundColor
+        && other.contentTextStyle == contentTextStyle
+        && other.padding == padding
+        && other.leadingPadding == leadingPadding;
   }
 
   @override
diff --git a/packages/flutter/lib/src/material/bottom_app_bar_theme.dart b/packages/flutter/lib/src/material/bottom_app_bar_theme.dart
index 2444bd5..c8bc83f 100644
--- a/packages/flutter/lib/src/material/bottom_app_bar_theme.dart
+++ b/packages/flutter/lib/src/material/bottom_app_bar_theme.dart
@@ -92,10 +92,10 @@
       return true;
     if (other.runtimeType != runtimeType)
       return false;
-    final BottomAppBarTheme typedOther = other;
-    return typedOther.color == color
-        && typedOther.elevation == elevation
-        && typedOther.shape == shape;
+    return other is BottomAppBarTheme
+        && other.color == color
+        && other.elevation == elevation
+        && other.shape == shape;
   }
 
   @override
diff --git a/packages/flutter/lib/src/material/bottom_sheet.dart b/packages/flutter/lib/src/material/bottom_sheet.dart
index a461b25..9178dd1 100644
--- a/packages/flutter/lib/src/material/bottom_sheet.dart
+++ b/packages/flutter/lib/src/material/bottom_sheet.dart
@@ -152,7 +152,7 @@
   final GlobalKey _childKey = GlobalKey(debugLabel: 'BottomSheet child');
 
   double get _childHeight {
-    final RenderBox renderBox = _childKey.currentContext.findRenderObject();
+    final RenderBox renderBox = _childKey.currentContext.findRenderObject() as RenderBox;
     return renderBox.size.height;
   }
 
diff --git a/packages/flutter/lib/src/material/bottom_sheet_theme.dart b/packages/flutter/lib/src/material/bottom_sheet_theme.dart
index ba38084..2324b3f 100644
--- a/packages/flutter/lib/src/material/bottom_sheet_theme.dart
+++ b/packages/flutter/lib/src/material/bottom_sheet_theme.dart
@@ -123,13 +123,13 @@
       return true;
     if (other.runtimeType != runtimeType)
       return false;
-    final BottomSheetThemeData typedOther = other;
-    return typedOther.backgroundColor == backgroundColor
-        && typedOther.elevation == elevation
-        && typedOther.modalBackgroundColor == modalBackgroundColor
-        && typedOther.modalElevation == modalElevation
-        && typedOther.shape == shape
-        && typedOther.clipBehavior == clipBehavior;
+    return other is BottomSheetThemeData
+        && other.backgroundColor == backgroundColor
+        && other.elevation == elevation
+        && other.modalBackgroundColor == modalBackgroundColor
+        && other.modalElevation == modalElevation
+        && other.shape == shape
+        && other.clipBehavior == clipBehavior;
   }
 
   @override
diff --git a/packages/flutter/lib/src/material/button.dart b/packages/flutter/lib/src/material/button.dart
index efc2545..8862793 100644
--- a/packages/flutter/lib/src/material/button.dart
+++ b/packages/flutter/lib/src/material/button.dart
@@ -367,8 +367,8 @@
     final ShapeBorder effectiveShape =  MaterialStateProperty.resolveAs<ShapeBorder>(widget.shape, _states);
     final Offset densityAdjustment = widget.visualDensity.baseSizeAdjustment;
     final BoxConstraints effectiveConstraints = widget.constraints.copyWith(
-      minWidth: widget.constraints.minWidth != null ? (widget.constraints.minWidth + densityAdjustment.dx).clamp(0.0, double.infinity) : null,
-      minHeight: widget.constraints.minWidth != null ? (widget.constraints.minHeight + densityAdjustment.dy).clamp(0.0, double.infinity) : null,
+      minWidth: widget.constraints.minWidth != null ? (widget.constraints.minWidth + densityAdjustment.dx).clamp(0.0, double.infinity) as double : null,
+      minHeight: widget.constraints.minWidth != null ? (widget.constraints.minHeight + densityAdjustment.dy).clamp(0.0, double.infinity) as double : null,
     );
     final EdgeInsetsGeometry padding = widget.padding.add(
       EdgeInsets.only(
@@ -517,8 +517,8 @@
       final double height = math.max(child.size.width, minSize.width);
       final double width = math.max(child.size.height, minSize.height);
       size = constraints.constrain(Size(height, width));
-      final BoxParentData childParentData = child.parentData;
-      childParentData.offset = Alignment.center.alongOffset(size - child.size);
+      final BoxParentData childParentData = child.parentData as BoxParentData;
+      childParentData.offset = Alignment.center.alongOffset(size - child.size as Offset);
     } else {
       size = Size.zero;
     }
diff --git a/packages/flutter/lib/src/material/button_bar.dart b/packages/flutter/lib/src/material/button_bar.dart
index 03e5075..471d150 100644
--- a/packages/flutter/lib/src/material/button_bar.dart
+++ b/packages/flutter/lib/src/material/button_bar.dart
@@ -316,7 +316,7 @@
       double currentHeight = 0.0;
 
       while (child != null) {
-        final FlexParentData childParentData = child.parentData;
+        final FlexParentData childParentData = child.parentData as FlexParentData;
 
         // Lay out the child with the button bar's original constraints, but
         // with minimum width set to zero.
diff --git a/packages/flutter/lib/src/material/button_bar_theme.dart b/packages/flutter/lib/src/material/button_bar_theme.dart
index e8752ff..bbcacc1 100644
--- a/packages/flutter/lib/src/material/button_bar_theme.dart
+++ b/packages/flutter/lib/src/material/button_bar_theme.dart
@@ -136,7 +136,7 @@
       buttonTextTheme: t < 0.5 ? a.buttonTextTheme : b.buttonTextTheme,
       buttonMinWidth: lerpDouble(a?.buttonMinWidth, b?.buttonMinWidth, t),
       buttonHeight: lerpDouble(a?.buttonHeight, b?.buttonHeight, t),
-      buttonPadding: EdgeInsets.lerp(a?.buttonPadding, b?.buttonPadding, t),
+      buttonPadding: EdgeInsetsGeometry.lerp(a?.buttonPadding, b?.buttonPadding, t),
       buttonAlignedDropdown: t < 0.5 ? a.buttonAlignedDropdown : b.buttonAlignedDropdown,
       layoutBehavior: t < 0.5 ? a.layoutBehavior : b.layoutBehavior,
     );
@@ -162,15 +162,15 @@
       return true;
     if (other.runtimeType != runtimeType)
       return false;
-    final ButtonBarThemeData typedOther = other;
-    return typedOther.alignment == alignment
-        && typedOther.mainAxisSize == mainAxisSize
-        && typedOther.buttonTextTheme == buttonTextTheme
-        && typedOther.buttonMinWidth == buttonMinWidth
-        && typedOther.buttonHeight == buttonHeight
-        && typedOther.buttonPadding == buttonPadding
-        && typedOther.buttonAlignedDropdown == buttonAlignedDropdown
-        && typedOther.layoutBehavior == layoutBehavior;
+    return other is ButtonBarThemeData
+        && other.alignment == alignment
+        && other.mainAxisSize == mainAxisSize
+        && other.buttonTextTheme == buttonTextTheme
+        && other.buttonMinWidth == buttonMinWidth
+        && other.buttonHeight == buttonHeight
+        && other.buttonPadding == buttonPadding
+        && other.buttonAlignedDropdown == buttonAlignedDropdown
+        && other.layoutBehavior == layoutBehavior;
   }
 
   @override
diff --git a/packages/flutter/lib/src/material/button_theme.dart b/packages/flutter/lib/src/material/button_theme.dart
index fc39d45..fbe6d47 100644
--- a/packages/flutter/lib/src/material/button_theme.dart
+++ b/packages/flutter/lib/src/material/button_theme.dart
@@ -907,21 +907,21 @@
   bool operator ==(dynamic other) {
     if (other.runtimeType != runtimeType)
       return false;
-    final ButtonThemeData typedOther = other;
-    return textTheme == typedOther.textTheme
-        && minWidth == typedOther.minWidth
-        && height == typedOther.height
-        && padding == typedOther.padding
-        && shape == typedOther.shape
-        && alignedDropdown == typedOther.alignedDropdown
-        && _buttonColor == typedOther._buttonColor
-        && _disabledColor == typedOther._disabledColor
-        && _focusColor == typedOther._focusColor
-        && _hoverColor == typedOther._hoverColor
-        && _highlightColor == typedOther._highlightColor
-        && _splashColor == typedOther._splashColor
-        && colorScheme == typedOther.colorScheme
-        && _materialTapTargetSize == typedOther._materialTapTargetSize;
+    return other is ButtonThemeData
+        && other.textTheme == textTheme
+        && other.minWidth == minWidth
+        && other.height == height
+        && other.padding == padding
+        && other.shape == shape
+        && other.alignedDropdown == alignedDropdown
+        && other._buttonColor == _buttonColor
+        && other._disabledColor == _disabledColor
+        && other._focusColor == _focusColor
+        && other._hoverColor == _hoverColor
+        && other._highlightColor == _highlightColor
+        && other._splashColor == _splashColor
+        && other.colorScheme == colorScheme
+        && other._materialTapTargetSize == _materialTapTargetSize;
   }
 
   @override
diff --git a/packages/flutter/lib/src/material/card_theme.dart b/packages/flutter/lib/src/material/card_theme.dart
index 57041e3..37b2609 100644
--- a/packages/flutter/lib/src/material/card_theme.dart
+++ b/packages/flutter/lib/src/material/card_theme.dart
@@ -122,12 +122,12 @@
       return true;
     if (other.runtimeType != runtimeType)
       return false;
-    final CardTheme typedOther = other;
-    return typedOther.clipBehavior == clipBehavior
-        && typedOther.color == color
-        && typedOther.elevation == elevation
-        && typedOther.margin == margin
-        && typedOther.shape == shape;
+    return other is CardTheme
+        && other.clipBehavior == clipBehavior
+        && other.color == color
+        && other.elevation == elevation
+        && other.margin == margin
+        && other.shape == shape;
   }
 
   @override
diff --git a/packages/flutter/lib/src/material/checkbox.dart b/packages/flutter/lib/src/material/checkbox.dart
index c3fee88..ba61e67 100644
--- a/packages/flutter/lib/src/material/checkbox.dart
+++ b/packages/flutter/lib/src/material/checkbox.dart
@@ -458,7 +458,7 @@
     paintRadialReaction(canvas, offset, size.center(Offset.zero));
 
     final Paint strokePaint = _createStrokePaint();
-    final Offset origin = offset + (size / 2.0 - const Size.square(_kEdgeSize) / 2.0);
+    final Offset origin = offset + (size / 2.0 - const Size.square(_kEdgeSize) / 2.0 as Offset);
     final AnimationStatus status = position.status;
     final double tNormalized = status == AnimationStatus.forward || status == AnimationStatus.completed
       ? position.value
diff --git a/packages/flutter/lib/src/material/chip.dart b/packages/flutter/lib/src/material/chip.dart
index 3e7c93b..85b0e35 100644
--- a/packages/flutter/lib/src/material/chip.dart
+++ b/packages/flutter/lib/src/material/chip.dart
@@ -1532,7 +1532,7 @@
   @override
   final Color checkmarkColor;
   @override
-  final CircleBorder avatarBorder;
+  final ShapeBorder avatarBorder;
 
   /// If set, this indicates that the chip should be disabled if all of the
   /// tap callbacks ([onSelected], [onPressed]) are null.
@@ -2045,10 +2045,10 @@
   final Map<Element, _ChipSlot> childToSlot = <Element, _ChipSlot>{};
 
   @override
-  _ChipRenderWidget get widget => super.widget;
+  _ChipRenderWidget get widget => super.widget as _ChipRenderWidget;
 
   @override
-  _RenderChip get renderObject => super.renderObject;
+  _RenderChip get renderObject => super.renderObject as _RenderChip;
 
   @override
   void visitChildren(ElementVisitor visitor) {
@@ -2110,13 +2110,13 @@
   void _updateRenderObject(RenderObject child, _ChipSlot slot) {
     switch (slot) {
       case _ChipSlot.avatar:
-        renderObject.avatar = child;
+        renderObject.avatar = child as RenderBox;
         break;
       case _ChipSlot.label:
-        renderObject.label = child;
+        renderObject.label = child as RenderBox;
         break;
       case _ChipSlot.deleteIcon:
-        renderObject.deleteIcon = child;
+        renderObject.deleteIcon = child as RenderBox;
         break;
     }
   }
@@ -2125,7 +2125,7 @@
   void insertChildRenderObject(RenderObject child, dynamic slotValue) {
     assert(child is RenderBox);
     assert(slotValue is _ChipSlot);
-    final _ChipSlot slot = slotValue;
+    final _ChipSlot slot = slotValue as _ChipSlot;
     _updateRenderObject(child, slot);
     assert(renderObject.childToSlot.keys.contains(child));
     assert(renderObject.slotToChild.keys.contains(slot));
@@ -2181,17 +2181,17 @@
     if (other.runtimeType != runtimeType) {
       return false;
     }
-    final _ChipRenderTheme typedOther = other;
-    return typedOther.avatar == avatar
-        && typedOther.label == label
-        && typedOther.deleteIcon == deleteIcon
-        && typedOther.brightness == brightness
-        && typedOther.padding == padding
-        && typedOther.labelPadding == labelPadding
-        && typedOther.showAvatar == showAvatar
-        && typedOther.showCheckmark == showCheckmark
-        && typedOther.checkmarkColor == checkmarkColor
-        && typedOther.canTapBody == canTapBody;
+    return other is _ChipRenderTheme
+        && other.avatar == avatar
+        && other.label == label
+        && other.deleteIcon == deleteIcon
+        && other.brightness == brightness
+        && other.padding == padding
+        && other.labelPadding == labelPadding
+        && other.showAvatar == showAvatar
+        && other.showCheckmark == showCheckmark
+        && other.checkmarkColor == checkmarkColor
+        && other.canTapBody == canTapBody;
   }
 
   @override
@@ -2373,7 +2373,7 @@
 
   static Rect _boxRect(RenderBox box) => box == null ? Rect.zero : _boxParentData(box).offset & box.size;
 
-  static BoxParentData _boxParentData(RenderBox box) => box.parentData;
+  static BoxParentData _boxParentData(RenderBox box) => box.parentData as BoxParentData;
 
   @override
   double computeMinIntrinsicWidth(double height) {
@@ -2895,7 +2895,7 @@
 
     if (tapIsOnDeleteIcon) {
       final RenderBox currentBox = referenceBox;
-      referenceBox = deleteIconKey.currentContext.findRenderObject();
+      referenceBox = deleteIconKey.currentContext.findRenderObject() as RenderBox;
       position = referenceBox.globalToLocal(currentBox.localToGlobal(position));
       containedInkWell = false;
     }
diff --git a/packages/flutter/lib/src/material/chip_theme.dart b/packages/flutter/lib/src/material/chip_theme.dart
index 2a49299..27ece6b 100644
--- a/packages/flutter/lib/src/material/chip_theme.dart
+++ b/packages/flutter/lib/src/material/chip_theme.dart
@@ -484,23 +484,23 @@
     if (other.runtimeType != runtimeType) {
       return false;
     }
-    final ChipThemeData otherData = other;
-    return otherData.backgroundColor == backgroundColor
-        && otherData.deleteIconColor == deleteIconColor
-        && otherData.disabledColor == disabledColor
-        && otherData.selectedColor == selectedColor
-        && otherData.secondarySelectedColor == secondarySelectedColor
-        && otherData.shadowColor == shadowColor
-        && otherData.selectedShadowColor == selectedShadowColor
-        && otherData.checkmarkColor == checkmarkColor
-        && otherData.labelPadding == labelPadding
-        && otherData.padding == padding
-        && otherData.shape == shape
-        && otherData.labelStyle == labelStyle
-        && otherData.secondaryLabelStyle == secondaryLabelStyle
-        && otherData.brightness == brightness
-        && otherData.elevation == elevation
-        && otherData.pressElevation == pressElevation;
+    return other is ChipThemeData
+        && other.backgroundColor == backgroundColor
+        && other.deleteIconColor == deleteIconColor
+        && other.disabledColor == disabledColor
+        && other.selectedColor == selectedColor
+        && other.secondarySelectedColor == secondarySelectedColor
+        && other.shadowColor == shadowColor
+        && other.selectedShadowColor == selectedShadowColor
+        && other.checkmarkColor == checkmarkColor
+        && other.labelPadding == labelPadding
+        && other.padding == padding
+        && other.shape == shape
+        && other.labelStyle == labelStyle
+        && other.secondaryLabelStyle == secondaryLabelStyle
+        && other.brightness == brightness
+        && other.elevation == elevation
+        && other.pressElevation == pressElevation;
   }
 
   @override
diff --git a/packages/flutter/lib/src/material/color_scheme.dart b/packages/flutter/lib/src/material/color_scheme.dart
index 3f5f062..74414d8 100644
--- a/packages/flutter/lib/src/material/color_scheme.dart
+++ b/packages/flutter/lib/src/material/color_scheme.dart
@@ -268,20 +268,20 @@
       return true;
     if (other.runtimeType != runtimeType)
       return false;
-    final ColorScheme otherScheme = other;
-    return otherScheme.primary == primary
-        && otherScheme.primaryVariant == primaryVariant
-        && otherScheme.secondary == secondary
-        && otherScheme.secondaryVariant == secondaryVariant
-        && otherScheme.surface == surface
-        && otherScheme.background == background
-        && otherScheme.error == error
-        && otherScheme.onPrimary == onPrimary
-        && otherScheme.onSecondary == onSecondary
-        && otherScheme.onSurface == onSurface
-        && otherScheme.onBackground == onBackground
-        && otherScheme.onError == onError
-        && otherScheme.brightness == brightness;
+    return other is ColorScheme
+        && other.primary == primary
+        && other.primaryVariant == primaryVariant
+        && other.secondary == secondary
+        && other.secondaryVariant == secondaryVariant
+        && other.surface == surface
+        && other.background == background
+        && other.error == error
+        && other.onPrimary == onPrimary
+        && other.onSecondary == onSecondary
+        && other.onSurface == onSurface
+        && other.onBackground == onBackground
+        && other.onError == onError
+        && other.brightness == brightness;
   }
 
   @override
diff --git a/packages/flutter/lib/src/material/data_table.dart b/packages/flutter/lib/src/material/data_table.dart
index 37b8391..4d9c29f 100644
--- a/packages/flutter/lib/src/material/data_table.dart
+++ b/packages/flutter/lib/src/material/data_table.dart
@@ -750,14 +750,14 @@
       AbstractNode table = cell.parent;
       final Matrix4 transform = Matrix4.identity();
       while (table is RenderObject && table is! RenderTable) {
-        final RenderTable parentBox = table;
+        final RenderObject parentBox = table as RenderObject;
         parentBox.applyPaintTransform(cell, transform);
         assert(table == cell.parent);
-        cell = table;
+        cell = parentBox;
         table = table.parent;
       }
       if (table is RenderTable) {
-        final TableCellParentData cellParentData = cell.parentData;
+        final TableCellParentData cellParentData = cell.parentData as TableCellParentData;
         assert(cellParentData.y != null);
         final Rect rect = table.getRowBox(cellParentData.y);
         // The rect is in the table's coordinate space. We need to change it to the
diff --git a/packages/flutter/lib/src/material/dialog_theme.dart b/packages/flutter/lib/src/material/dialog_theme.dart
index f67b213..68fb204 100644
--- a/packages/flutter/lib/src/material/dialog_theme.dart
+++ b/packages/flutter/lib/src/material/dialog_theme.dart
@@ -109,12 +109,12 @@
       return true;
     if (other.runtimeType != runtimeType)
       return false;
-    final DialogTheme typedOther = other;
-    return typedOther.backgroundColor == backgroundColor
-        && typedOther.elevation == elevation
-        && typedOther.shape == shape
-        && typedOther.titleTextStyle == titleTextStyle
-        && typedOther.contentTextStyle == contentTextStyle;
+    return other is DialogTheme
+        && other.backgroundColor == backgroundColor
+        && other.elevation == elevation
+        && other.shape == shape
+        && other.titleTextStyle == titleTextStyle
+        && other.contentTextStyle == contentTextStyle;
   }
 
   @override
diff --git a/packages/flutter/lib/src/material/divider_theme.dart b/packages/flutter/lib/src/material/divider_theme.dart
index 44b7d44..4aa0135 100644
--- a/packages/flutter/lib/src/material/divider_theme.dart
+++ b/packages/flutter/lib/src/material/divider_theme.dart
@@ -110,12 +110,12 @@
       return true;
     if (other.runtimeType != runtimeType)
       return false;
-    final DividerThemeData typedOther = other;
-    return typedOther.color == color
-        && typedOther.space == space
-        && typedOther.thickness == thickness
-        && typedOther.indent == indent
-        && typedOther.endIndent == endIndent;
+    return other is DividerThemeData
+        && other.color == color
+        && other.space == space
+        && other.thickness == thickness
+        && other.indent == indent
+        && other.endIndent == endIndent;
   }
 
   @override
diff --git a/packages/flutter/lib/src/material/drawer.dart b/packages/flutter/lib/src/material/drawer.dart
index 141f518..ff292d8 100644
--- a/packages/flutter/lib/src/material/drawer.dart
+++ b/packages/flutter/lib/src/material/drawer.dart
@@ -381,7 +381,7 @@
   final GlobalKey _drawerKey = GlobalKey();
 
   double get _width {
-    final RenderBox box = _drawerKey.currentContext?.findRenderObject();
+    final RenderBox box = _drawerKey.currentContext?.findRenderObject() as RenderBox;
     if (box != null)
       return box.size.width;
     return _kWidth; // drawer not being shown currently
diff --git a/packages/flutter/lib/src/material/dropdown.dart b/packages/flutter/lib/src/material/dropdown.dart
index 00665e0..4edeffb 100644
--- a/packages/flutter/lib/src/material/dropdown.dart
+++ b/packages/flutter/lib/src/material/dropdown.dart
@@ -62,12 +62,12 @@
   void paint(Canvas canvas, Size size) {
     final double selectedItemOffset = getSelectedItemOffset();
     final Tween<double> top = Tween<double>(
-      begin: selectedItemOffset.clamp(0.0, size.height - _kMenuItemHeight),
+      begin: selectedItemOffset.clamp(0.0, size.height - _kMenuItemHeight) as double,
       end: 0.0,
     );
 
     final Tween<double> bottom = Tween<double>(
-      begin: (top.begin + _kMenuItemHeight).clamp(_kMenuItemHeight, size.height),
+      begin: (top.begin + _kMenuItemHeight).clamp(_kMenuItemHeight, size.height) as double,
       end: size.height,
     );
 
@@ -162,8 +162,8 @@
     if (widget.itemIndex == widget.route.selectedIndex) {
       opacity = CurvedAnimation(parent: widget.route.animation, curve: const Threshold(0.0));
     } else {
-      final double start = (0.5 + (widget.itemIndex + 1) * unit).clamp(0.0, 1.0);
-      final double end = (start + 1.5 * unit).clamp(0.0, 1.0);
+      final double start = (0.5 + (widget.itemIndex + 1) * unit).clamp(0.0, 1.0) as double;
+      final double end = (start + 1.5 * unit).clamp(0.0, 1.0) as double;
       opacity = CurvedAnimation(parent: widget.route.animation, curve: Interval(start, end));
     }
     Widget child = FadeTransition(
@@ -341,10 +341,10 @@
     double left;
     switch (textDirection) {
       case TextDirection.rtl:
-        left = buttonRect.right.clamp(0.0, size.width) - childSize.width;
+        left = (buttonRect.right.clamp(0.0, size.width) as double) - childSize.width;
         break;
       case TextDirection.ltr:
-        left = buttonRect.left.clamp(0.0, size.width - childSize.width);
+        left = buttonRect.left.clamp(0.0, size.width - childSize.width) as double;
         break;
     }
 
@@ -367,10 +367,8 @@
 
   @override
   bool operator ==(dynamic other) {
-    if (other is! _DropdownRouteResult<T>)
-      return false;
-    final _DropdownRouteResult<T> typedOther = other;
-    return result == typedOther.result;
+    return other is _DropdownRouteResult<T>
+        && other.result == result;
   }
 
   @override
@@ -1133,7 +1131,7 @@
   TextStyle get _textStyle => widget.style ?? Theme.of(context).textTheme.subhead;
 
   void _handleTap() {
-    final RenderBox itemBox = context.findRenderObject();
+    final RenderBox itemBox = context.findRenderObject() as RenderBox;
     final Rect itemRect = itemBox.localToGlobal(Offset.zero) & itemBox.size;
     final TextDirection textDirection = Directionality.of(context);
     final EdgeInsetsGeometry menuMargin = ButtonTheme.of(context).alignedDropdown
@@ -1476,7 +1474,7 @@
 
 class _DropdownButtonFormFieldState<T> extends FormFieldState<T> {
   @override
-  DropdownButtonFormField<T> get widget => super.widget;
+  DropdownButtonFormField<T> get widget => super.widget as DropdownButtonFormField<T>;
 
   @override
   void didChange(T value) {
diff --git a/packages/flutter/lib/src/material/expansion_panel.dart b/packages/flutter/lib/src/material/expansion_panel.dart
index 161d8e2..6a8df6b 100644
--- a/packages/flutter/lib/src/material/expansion_panel.dart
+++ b/packages/flutter/lib/src/material/expansion_panel.dart
@@ -25,9 +25,9 @@
   bool operator ==(dynamic other) {
     if (other.runtimeType != runtimeType)
       return false;
-    final _SaltedKey<S, V> typedOther = other;
-    return salt == typedOther.salt
-        && value == typedOther.value;
+    return other is _SaltedKey<S, V>
+        && other.salt == salt
+        && other.value == value;
   }
 
   @override
@@ -364,7 +364,8 @@
     if (widget._allowOnlyOnePanelOpen) {
       assert(_allIdentifiersUnique(), 'All ExpansionPanelRadio identifier values must be unique.');
       if (widget.initialOpenPanelValue != null) {
-        _currentOpenPanel = searchPanelByValue(widget.children, widget.initialOpenPanelValue);
+        _currentOpenPanel =
+          searchPanelByValue(widget.children.cast<ExpansionPanelRadio>(), widget.initialOpenPanelValue);
       }
     }
   }
@@ -378,7 +379,8 @@
       // If the previous widget was non-radio ExpansionPanelList, initialize the
       // open panel to widget.initialOpenPanelValue
       if (!oldWidget._allowOnlyOnePanelOpen) {
-        _currentOpenPanel = searchPanelByValue(widget.children, widget.initialOpenPanelValue);
+        _currentOpenPanel =
+          searchPanelByValue(widget.children.cast<ExpansionPanelRadio>(), widget.initialOpenPanelValue);
       }
     } else {
       _currentOpenPanel = null;
@@ -387,7 +389,7 @@
 
   bool _allIdentifiersUnique() {
     final Map<Object, bool> identifierMap = <Object, bool>{};
-    for (ExpansionPanelRadio child in widget.children) {
+    for (ExpansionPanelRadio child in widget.children.cast<ExpansionPanelRadio>()) {
       identifierMap[child.value] = true;
     }
     return identifierMap.length == widget.children.length;
@@ -395,7 +397,7 @@
 
   bool _isChildExpanded(int index) {
     if (widget._allowOnlyOnePanelOpen) {
-      final ExpansionPanelRadio radioWidget = widget.children[index];
+      final ExpansionPanelRadio radioWidget = widget.children[index] as ExpansionPanelRadio;
       return _currentOpenPanel?.value == radioWidget.value;
     }
     return widget.children[index].isExpanded;
@@ -406,12 +408,12 @@
       widget.expansionCallback(index, isExpanded);
 
     if (widget._allowOnlyOnePanelOpen) {
-      final ExpansionPanelRadio pressedChild = widget.children[index];
+      final ExpansionPanelRadio pressedChild = widget.children[index] as ExpansionPanelRadio;
 
       // If another ExpansionPanelRadio was already open, apply its
       // expansionCallback (if any) to false, because it's closing.
       for (int childIndex = 0; childIndex < widget.children.length; childIndex += 1) {
-        final ExpansionPanelRadio child = widget.children[childIndex];
+        final ExpansionPanelRadio child = widget.children[childIndex] as ExpansionPanelRadio;
         if (widget.expansionCallback != null &&
             childIndex != index &&
             child.value == _currentOpenPanel?.value)
diff --git a/packages/flutter/lib/src/material/expansion_tile.dart b/packages/flutter/lib/src/material/expansion_tile.dart
index a87791c..0121e75 100644
--- a/packages/flutter/lib/src/material/expansion_tile.dart
+++ b/packages/flutter/lib/src/material/expansion_tile.dart
@@ -115,7 +115,7 @@
     _iconColor = _controller.drive(_iconColorTween.chain(_easeInTween));
     _backgroundColor = _controller.drive(_backgroundColorTween.chain(_easeOutTween));
 
-    _isExpanded = PageStorage.of(context)?.readState(context) ?? widget.initiallyExpanded;
+    _isExpanded = PageStorage.of(context)?.readState(context) as bool ?? widget.initiallyExpanded;
     if (_isExpanded)
       _controller.value = 1.0;
   }
diff --git a/packages/flutter/lib/src/material/flexible_space_bar.dart b/packages/flutter/lib/src/material/flexible_space_bar.dart
index 12b8237..9ac1ed9 100644
--- a/packages/flutter/lib/src/material/flexible_space_bar.dart
+++ b/packages/flutter/lib/src/material/flexible_space_bar.dart
@@ -288,7 +288,7 @@
 
         // 0.0 -> Expanded
         // 1.0 -> Collapsed to toolbar
-        final double t = (1.0 - (settings.currentExtent - settings.minExtent) / deltaExtent).clamp(0.0, 1.0);
+        final double t = (1.0 - (settings.currentExtent - settings.minExtent) / deltaExtent).clamp(0.0, 1.0) as double;
 
         // background
         if (widget.background != null) {
@@ -358,7 +358,7 @@
           if (widget.stretchModes.contains(StretchMode.fadeTitle) &&
             constraints.maxHeight > settings.maxExtent) {
             final double stretchOpacity = 1 -
-              ((constraints.maxHeight - settings.maxExtent) / 100).clamp(0.0, 1.0);
+              (((constraints.maxHeight - settings.maxExtent) / 100).clamp(0.0, 1.0) as double);
             title = Opacity(
               opacity: stretchOpacity,
               child: title,
diff --git a/packages/flutter/lib/src/material/floating_action_button_theme.dart b/packages/flutter/lib/src/material/floating_action_button_theme.dart
index 5973edf..84c22d7 100644
--- a/packages/flutter/lib/src/material/floating_action_button_theme.dart
+++ b/packages/flutter/lib/src/material/floating_action_button_theme.dart
@@ -165,18 +165,18 @@
       return true;
     if (other.runtimeType != runtimeType)
       return false;
-    final FloatingActionButtonThemeData otherData = other;
-    return otherData.foregroundColor == foregroundColor
-        && otherData.backgroundColor == backgroundColor
-        && otherData.focusColor == focusColor
-        && otherData.hoverColor == hoverColor
-        && otherData.splashColor == splashColor
-        && otherData.elevation == elevation
-        && otherData.focusElevation == focusElevation
-        && otherData.hoverElevation == hoverElevation
-        && otherData.disabledElevation == disabledElevation
-        && otherData.highlightElevation == highlightElevation
-        && otherData.shape == shape;
+    return other is FloatingActionButtonThemeData
+        && other.foregroundColor == foregroundColor
+        && other.backgroundColor == backgroundColor
+        && other.focusColor == focusColor
+        && other.hoverColor == hoverColor
+        && other.splashColor == splashColor
+        && other.elevation == elevation
+        && other.focusElevation == focusElevation
+        && other.hoverElevation == hoverElevation
+        && other.disabledElevation == disabledElevation
+        && other.highlightElevation == highlightElevation
+        && other.shape == shape;
   }
 
   @override
diff --git a/packages/flutter/lib/src/material/ink_decoration.dart b/packages/flutter/lib/src/material/ink_decoration.dart
index 1c6e484..57c5860 100644
--- a/packages/flutter/lib/src/material/ink_decoration.dart
+++ b/packages/flutter/lib/src/material/ink_decoration.dart
@@ -252,7 +252,7 @@
         decoration: widget.decoration,
         configuration: createLocalImageConfiguration(context),
         controller: Material.of(context),
-        referenceBox: context.findRenderObject(),
+        referenceBox: context.findRenderObject() as RenderBox,
         onRemoved: _handleRemoved,
       );
     } else {
diff --git a/packages/flutter/lib/src/material/ink_well.dart b/packages/flutter/lib/src/material/ink_well.dart
index c2fc5c5..6474842 100644
--- a/packages/flutter/lib/src/material/ink_well.dart
+++ b/packages/flutter/lib/src/material/ink_well.dart
@@ -511,7 +511,7 @@
   }
 
   @override
-  void didUpdateWidget(InkResponse oldWidget) {
+  void didUpdateWidget(T oldWidget) {
     super.didUpdateWidget(oldWidget);
     if (_isWidgetEnabled(widget) != _isWidgetEnabled(oldWidget)) {
       _handleHoverChange(_hovering);
@@ -565,7 +565,7 @@
       return;
     if (value) {
       if (highlight == null) {
-        final RenderBox referenceBox = context.findRenderObject();
+        final RenderBox referenceBox = context.findRenderObject() as RenderBox;
         _highlights[type] = InkHighlight(
           controller: Material.of(context),
           referenceBox: referenceBox,
@@ -603,7 +603,7 @@
 
   InteractiveInkFeature _createInkFeature(Offset globalPosition) {
     final MaterialInkController inkController = Material.of(context);
-    final RenderBox referenceBox = context.findRenderObject();
+    final RenderBox referenceBox = context.findRenderObject() as RenderBox;
     final Offset position = referenceBox.globalToLocal(globalPosition);
     final Color color = widget.splashColor ?? Theme.of(context).splashColor;
     final RectCallback rectCallback = widget.containedInkWell ? widget.getRectCallback(referenceBox) : null;
@@ -681,7 +681,7 @@
 
     Offset globalPosition;
     if (context != null) {
-      final RenderBox referenceBox = context.findRenderObject();
+      final RenderBox referenceBox = context.findRenderObject() as RenderBox;
       assert(referenceBox.hasSize, 'InkResponse must be done with layout before starting a splash.');
       globalPosition = referenceBox.localToGlobal(referenceBox.paintBounds.center);
     } else {
diff --git a/packages/flutter/lib/src/material/input_border.dart b/packages/flutter/lib/src/material/input_border.dart
index 08bc159..e225bd9 100644
--- a/packages/flutter/lib/src/material/input_border.dart
+++ b/packages/flutter/lib/src/material/input_border.dart
@@ -240,8 +240,8 @@
       return true;
     if (runtimeType != other.runtimeType)
       return false;
-    final InputBorder typedOther = other;
-    return typedOther.borderSide == borderSide;
+    return other is InputBorder
+        && other.borderSide == borderSide;
   }
 
   @override
@@ -497,10 +497,10 @@
       return true;
     if (runtimeType != other.runtimeType)
       return false;
-    final OutlineInputBorder typedOther = other;
-    return typedOther.borderSide == borderSide
-        && typedOther.borderRadius == borderRadius
-        && typedOther.gapPadding == gapPadding;
+    return other is OutlineInputBorder
+        && other.borderSide == borderSide
+        && other.borderRadius == borderRadius
+        && other.gapPadding == gapPadding;
   }
 
   @override
diff --git a/packages/flutter/lib/src/material/input_decorator.dart b/packages/flutter/lib/src/material/input_decorator.dart
index b85b9fc..1ce7920 100644
--- a/packages/flutter/lib/src/material/input_decorator.dart
+++ b/packages/flutter/lib/src/material/input_decorator.dart
@@ -44,8 +44,9 @@
       return true;
     if (runtimeType != other.runtimeType)
       return false;
-    final _InputBorderGap typedOther = other;
-    return typedOther.start == start && typedOther.extent == extent;
+    return other is _InputBorderGap
+        && other.start == start
+        && other.extent == extent;
   }
 
   @override
@@ -57,7 +58,7 @@
   _InputBorderTween({InputBorder begin, InputBorder end}) : super(begin: begin, end: end);
 
   @override
-  InputBorder lerp(double t) => ShapeBorder.lerp(begin, end, t);
+  InputBorder lerp(double t) => ShapeBorder.lerp(begin, end, t) as InputBorder;
 }
 
 // Passes the _InputBorderGap parameters along to an InputBorder's paint method.
@@ -253,7 +254,7 @@
 
   final Widget child;
 
-  Animation<double> get animation => listenable;
+  Animation<double> get animation => listenable as Animation<double>;
 
   double get translateX {
     const double shakeDelta = 4.0;
@@ -529,24 +530,24 @@
       return true;
     if (other.runtimeType != runtimeType)
       return false;
-    final _Decoration typedOther = other;
-    return typedOther.contentPadding == contentPadding
-        && typedOther.floatingLabelHeight == floatingLabelHeight
-        && typedOther.floatingLabelProgress == floatingLabelProgress
-        && typedOther.border == border
-        && typedOther.borderGap == borderGap
-        && typedOther.icon == icon
-        && typedOther.input == input
-        && typedOther.label == label
-        && typedOther.hint == hint
-        && typedOther.prefix == prefix
-        && typedOther.suffix == suffix
-        && typedOther.prefixIcon == prefixIcon
-        && typedOther.suffixIcon == suffixIcon
-        && typedOther.helperError == helperError
-        && typedOther.counter == counter
-        && typedOther.container == container
-        && typedOther.alignLabelWithHint == alignLabelWithHint;
+    return other is _Decoration
+        && other.contentPadding == contentPadding
+        && other.floatingLabelHeight == floatingLabelHeight
+        && other.floatingLabelProgress == floatingLabelProgress
+        && other.border == border
+        && other.borderGap == borderGap
+        && other.icon == icon
+        && other.input == input
+        && other.label == label
+        && other.hint == hint
+        && other.prefix == prefix
+        && other.suffix == suffix
+        && other.prefixIcon == prefixIcon
+        && other.suffixIcon == suffixIcon
+        && other.helperError == helperError
+        && other.counter == counter
+        && other.container == container
+        && other.alignLabelWithHint == alignLabelWithHint;
   }
 
   @override
@@ -897,9 +898,9 @@
 
   static Size _boxSize(RenderBox box) => box == null ? Size.zero : box.size;
 
-  static BoxParentData _boxParentData(RenderBox box) => box.parentData;
+  static BoxParentData _boxParentData(RenderBox box) => box.parentData as BoxParentData;
 
-  EdgeInsets get contentPadding => decoration.contentPadding;
+  EdgeInsets get contentPadding => decoration.contentPadding as EdgeInsets;
 
   // Lay out the given box if needed, and return its baseline.
   double _layoutLineBox(RenderBox box, BoxConstraints constraints) {
@@ -1483,10 +1484,10 @@
   final Map<Element, _DecorationSlot> childToSlot = <Element, _DecorationSlot>{};
 
   @override
-  _Decorator get widget => super.widget;
+  _Decorator get widget => super.widget as _Decorator;
 
   @override
-  _RenderDecoration get renderObject => super.renderObject;
+  _RenderDecoration get renderObject => super.renderObject as _RenderDecoration;
 
   @override
   void visitChildren(ElementVisitor visitor) {
@@ -1561,7 +1562,7 @@
     _updateChild(widget.decoration.container, _DecorationSlot.container);
   }
 
-  void _updateRenderObject(RenderObject child, _DecorationSlot slot) {
+  void _updateRenderObject(RenderBox child, _DecorationSlot slot) {
     switch (slot) {
       case _DecorationSlot.icon:
         renderObject.icon = child;
@@ -1603,8 +1604,8 @@
   void insertChildRenderObject(RenderObject child, dynamic slotValue) {
     assert(child is RenderBox);
     assert(slotValue is _DecorationSlot);
-    final _DecorationSlot slot = slotValue;
-    _updateRenderObject(child, slot);
+    final _DecorationSlot slot = slotValue as _DecorationSlot;
+    _updateRenderObject(child as RenderBox, slot);
     assert(renderObject.childToSlot.keys.contains(child));
     assert(renderObject.slotToChild.keys.contains(slot));
   }
@@ -3193,47 +3194,47 @@
       return true;
     if (other.runtimeType != runtimeType)
       return false;
-    final InputDecoration typedOther = other;
-    return typedOther.icon == icon
-        && typedOther.labelText == labelText
-        && typedOther.labelStyle == labelStyle
-        && typedOther.helperText == helperText
-        && typedOther.helperStyle == helperStyle
-        && typedOther.helperMaxLines == helperMaxLines
-        && typedOther.hintText == hintText
-        && typedOther.hintStyle == hintStyle
-        && typedOther.hintMaxLines == hintMaxLines
-        && typedOther.errorText == errorText
-        && typedOther.errorStyle == errorStyle
-        && typedOther.errorMaxLines == errorMaxLines
-        && typedOther.hasFloatingPlaceholder == hasFloatingPlaceholder
-        && typedOther.isDense == isDense
-        && typedOther.contentPadding == contentPadding
-        && typedOther.isCollapsed == isCollapsed
-        && typedOther.prefixIcon == prefixIcon
-        && typedOther.prefix == prefix
-        && typedOther.prefixText == prefixText
-        && typedOther.prefixStyle == prefixStyle
-        && typedOther.suffixIcon == suffixIcon
-        && typedOther.suffix == suffix
-        && typedOther.suffixText == suffixText
-        && typedOther.suffixStyle == suffixStyle
-        && typedOther.counter == counter
-        && typedOther.counterText == counterText
-        && typedOther.counterStyle == counterStyle
-        && typedOther.filled == filled
-        && typedOther.fillColor == fillColor
-        && typedOther.focusColor == focusColor
-        && typedOther.hoverColor == hoverColor
-        && typedOther.errorBorder == errorBorder
-        && typedOther.focusedBorder == focusedBorder
-        && typedOther.focusedErrorBorder == focusedErrorBorder
-        && typedOther.disabledBorder == disabledBorder
-        && typedOther.enabledBorder == enabledBorder
-        && typedOther.border == border
-        && typedOther.enabled == enabled
-        && typedOther.semanticCounterText == semanticCounterText
-        && typedOther.alignLabelWithHint == alignLabelWithHint;
+    return other is InputDecoration
+        && other.icon == icon
+        && other.labelText == labelText
+        && other.labelStyle == labelStyle
+        && other.helperText == helperText
+        && other.helperStyle == helperStyle
+        && other.helperMaxLines == helperMaxLines
+        && other.hintText == hintText
+        && other.hintStyle == hintStyle
+        && other.hintMaxLines == hintMaxLines
+        && other.errorText == errorText
+        && other.errorStyle == errorStyle
+        && other.errorMaxLines == errorMaxLines
+        && other.hasFloatingPlaceholder == hasFloatingPlaceholder
+        && other.isDense == isDense
+        && other.contentPadding == contentPadding
+        && other.isCollapsed == isCollapsed
+        && other.prefixIcon == prefixIcon
+        && other.prefix == prefix
+        && other.prefixText == prefixText
+        && other.prefixStyle == prefixStyle
+        && other.suffixIcon == suffixIcon
+        && other.suffix == suffix
+        && other.suffixText == suffixText
+        && other.suffixStyle == suffixStyle
+        && other.counter == counter
+        && other.counterText == counterText
+        && other.counterStyle == counterStyle
+        && other.filled == filled
+        && other.fillColor == fillColor
+        && other.focusColor == focusColor
+        && other.hoverColor == hoverColor
+        && other.errorBorder == errorBorder
+        && other.focusedBorder == focusedBorder
+        && other.focusedErrorBorder == focusedErrorBorder
+        && other.disabledBorder == disabledBorder
+        && other.enabledBorder == enabledBorder
+        && other.border == border
+        && other.enabled == enabled
+        && other.semanticCounterText == semanticCounterText
+        && other.alignLabelWithHint == alignLabelWithHint;
   }
 
   @override
@@ -3770,31 +3771,31 @@
       return true;
     if (other.runtimeType != runtimeType)
       return false;
-    final InputDecorationTheme typedOther = other;
-    return typedOther.labelStyle == labelStyle
-        && typedOther.helperStyle == helperStyle
-        && typedOther.helperMaxLines == helperMaxLines
-        && typedOther.hintStyle == hintStyle
-        && typedOther.errorStyle == errorStyle
-        && typedOther.errorMaxLines == errorMaxLines
-        && typedOther.isDense == isDense
-        && typedOther.contentPadding == contentPadding
-        && typedOther.isCollapsed == isCollapsed
-        && typedOther.prefixStyle == prefixStyle
-        && typedOther.suffixStyle == suffixStyle
-        && typedOther.counterStyle == counterStyle
-        && typedOther.filled == filled
-        && typedOther.fillColor == fillColor
-        && typedOther.focusColor == focusColor
-        && typedOther.hoverColor == hoverColor
-        && typedOther.errorBorder == errorBorder
-        && typedOther.focusedBorder == focusedBorder
-        && typedOther.focusedErrorBorder == focusedErrorBorder
-        && typedOther.disabledBorder == disabledBorder
-        && typedOther.enabledBorder == enabledBorder
-        && typedOther.border == border
-        && typedOther.alignLabelWithHint == alignLabelWithHint
-        && typedOther.disabledBorder == disabledBorder;
+    return other is InputDecorationTheme
+        && other.labelStyle == labelStyle
+        && other.helperStyle == helperStyle
+        && other.helperMaxLines == helperMaxLines
+        && other.hintStyle == hintStyle
+        && other.errorStyle == errorStyle
+        && other.errorMaxLines == errorMaxLines
+        && other.isDense == isDense
+        && other.contentPadding == contentPadding
+        && other.isCollapsed == isCollapsed
+        && other.prefixStyle == prefixStyle
+        && other.suffixStyle == suffixStyle
+        && other.counterStyle == counterStyle
+        && other.filled == filled
+        && other.fillColor == fillColor
+        && other.focusColor == focusColor
+        && other.hoverColor == hoverColor
+        && other.errorBorder == errorBorder
+        && other.focusedBorder == focusedBorder
+        && other.focusedErrorBorder == focusedErrorBorder
+        && other.disabledBorder == disabledBorder
+        && other.enabledBorder == enabledBorder
+        && other.border == border
+        && other.alignLabelWithHint == alignLabelWithHint
+        && other.disabledBorder == disabledBorder;
   }
 
   @override
diff --git a/packages/flutter/lib/src/material/list_tile.dart b/packages/flutter/lib/src/material/list_tile.dart
index 24894f4..93836a2 100644
--- a/packages/flutter/lib/src/material/list_tile.dart
+++ b/packages/flutter/lib/src/material/list_tile.dart
@@ -975,10 +975,10 @@
   final Map<Element, _ListTileSlot> childToSlot = <Element, _ListTileSlot>{};
 
   @override
-  _ListTile get widget => super.widget;
+  _ListTile get widget => super.widget as _ListTile;
 
   @override
-  _RenderListTile get renderObject => super.renderObject;
+  _RenderListTile get renderObject => super.renderObject as _RenderListTile;
 
   @override
   void visitChildren(ElementVisitor visitor) {
@@ -1039,7 +1039,7 @@
     _updateChild(widget.trailing, _ListTileSlot.trailing);
   }
 
-  void _updateRenderObject(RenderObject child, _ListTileSlot slot) {
+  void _updateRenderObject(RenderBox child, _ListTileSlot slot) {
     switch (slot) {
       case _ListTileSlot.leading:
         renderObject.leading = child;
@@ -1060,8 +1060,8 @@
   void insertChildRenderObject(RenderObject child, dynamic slotValue) {
     assert(child is RenderBox);
     assert(slotValue is _ListTileSlot);
-    final _ListTileSlot slot = slotValue;
-    _updateRenderObject(child, slot);
+    final _ListTileSlot slot = slotValue as _ListTileSlot;
+    _updateRenderObject(child as RenderBox, slot);
     assert(renderObject.childToSlot.keys.contains(child));
     assert(renderObject.slotToChild.keys.contains(slot));
   }
@@ -1303,7 +1303,7 @@
   @override
   double computeDistanceToActualBaseline(TextBaseline baseline) {
     assert(title != null);
-    final BoxParentData parentData = title.parentData;
+    final BoxParentData parentData = title.parentData as BoxParentData;
     return parentData.offset.dy + title.getDistanceToActualBaseline(baseline);
   }
 
@@ -1319,7 +1319,7 @@
   }
 
   static void _positionBox(RenderBox box, Offset offset) {
-    final BoxParentData parentData = box.parentData;
+    final BoxParentData parentData = box.parentData as BoxParentData;
     parentData.offset = offset;
   }
 
@@ -1463,7 +1463,7 @@
   void paint(PaintingContext context, Offset offset) {
     void doPaint(RenderBox child) {
       if (child != null) {
-        final BoxParentData parentData = child.parentData;
+        final BoxParentData parentData = child.parentData as BoxParentData;
         context.paintChild(child, parentData.offset + offset);
       }
     }
@@ -1480,7 +1480,7 @@
   bool hitTestChildren(BoxHitTestResult result, { @required Offset position }) {
     assert(position != null);
     for (RenderBox child in _children) {
-      final BoxParentData parentData = child.parentData;
+      final BoxParentData parentData = child.parentData as BoxParentData;
       final bool isHit = result.addWithPaintOffset(
         offset: parentData.offset,
         position: position,
diff --git a/packages/flutter/lib/src/material/material.dart b/packages/flutter/lib/src/material/material.dart
index 1a87eec..6795424 100644
--- a/packages/flutter/lib/src/material/material.dart
+++ b/packages/flutter/lib/src/material/material.dart
@@ -358,7 +358,7 @@
     }
     contents = NotificationListener<LayoutChangedNotification>(
       onNotification: (LayoutChangedNotification notification) {
-        final _RenderInkFeatures renderer = _inkFeatureRenderer.currentContext.findRenderObject();
+        final _RenderInkFeatures renderer = _inkFeatureRenderer.currentContext.findRenderObject() as _RenderInkFeatures;
         renderer._didChangeLayout();
         return false;
       },
@@ -575,7 +575,7 @@
     this.onRemoved,
   }) : assert(controller != null),
        assert(referenceBox != null),
-       _controller = controller;
+       _controller = controller as _RenderInkFeatures;
 
   /// The [MaterialInkController] associated with this [InkFeature].
   ///
@@ -612,7 +612,7 @@
     final List<RenderObject> descendants = <RenderObject>[referenceBox];
     RenderObject node = referenceBox;
     while (node != _controller) {
-      node = node.parent;
+      node = node.parent as RenderObject;
       assert(node != null);
       descendants.add(node);
     }
@@ -734,9 +734,21 @@
 
   @override
   void forEachTween(TweenVisitor<dynamic> visitor) {
-    _elevation = visitor(_elevation, widget.elevation, (dynamic value) => Tween<double>(begin: value));
-    _shadowColor = visitor(_shadowColor, widget.shadowColor, (dynamic value) => ColorTween(begin: value));
-    _border = visitor(_border, widget.shape, (dynamic value) => ShapeBorderTween(begin: value));
+    _elevation = visitor(
+      _elevation,
+      widget.elevation,
+      (dynamic value) => Tween<double>(begin: value as double),
+    ) as Tween<double>;
+    _shadowColor = visitor(
+      _shadowColor,
+      widget.shadowColor,
+      (dynamic value) => ColorTween(begin: value as Color),
+    ) as ColorTween;
+    _border = visitor(
+      _border,
+      widget.shape,
+      (dynamic value) => ShapeBorderTween(begin: value as ShapeBorder),
+    ) as ShapeBorderTween;
   }
 
   @override
diff --git a/packages/flutter/lib/src/material/mergeable_material.dart b/packages/flutter/lib/src/material/mergeable_material.dart
index 021122c..b87251f 100644
--- a/packages/flutter/lib/src/material/mergeable_material.dart
+++ b/packages/flutter/lib/src/material/mergeable_material.dart
@@ -164,9 +164,10 @@
     _children = List<MergeableMaterialItem>.from(widget.children);
 
     for (int i = 0; i < _children.length; i += 1) {
-      if (_children[i] is MaterialGap) {
-        _initGap(_children[i]);
-        _animationTuples[_children[i].key].controller.value = 1.0; // Gaps are initially full-sized.
+      final MergeableMaterialItem child = _children[i];
+      if (child is MaterialGap) {
+        _initGap(child);
+        _animationTuples[child.key].controller.value = 1.0; // Gaps are initially full-sized.
       }
     }
     assert(_debugGapsAreValid(_children));
@@ -323,8 +324,9 @@
               double gapSizeSum = 0.0;
 
               while (startOld < j) {
-                if (_children[startOld] is MaterialGap) {
-                  final MaterialGap gap = _children[startOld];
+                final MergeableMaterialItem child = _children[startOld];
+                if (child is MaterialGap) {
+                  final MaterialGap gap = child;
                   gapSizeSum += gap.size;
                 }
 
@@ -364,21 +366,19 @@
               double gapSizeSum = 0.0;
 
               for (int k = startNew; k < i; k += 1) {
-                if (newChildren[k] is MaterialGap) {
-                  final MaterialGap gap = newChildren[k];
-                  gapSizeSum += gap.size;
+                final MergeableMaterialItem newChild = newChildren[k];
+                if (newChild is MaterialGap) {
+                  gapSizeSum += newChild.size;
                 }
               }
 
               // All gaps get proportional sizes of the original gap and they will
               // animate to their actual size.
               for (int k = startNew; k < i; k += 1) {
-                if (newChildren[k] is MaterialGap) {
-                  final MaterialGap gap = newChildren[k];
-
-                  _animationTuples[gap.key].gapStart = gapSize * gap.size /
-                      gapSizeSum;
-                  _animationTuples[gap.key].controller
+                final MergeableMaterialItem newChild = newChildren[k];
+                if (newChild is MaterialGap) {
+                  _animationTuples[newChild.key].gapStart = gapSize * newChild.size / gapSizeSum;
+                  _animationTuples[newChild.key].controller
                     ..value = 0.0
                     ..forward();
                 }
@@ -387,11 +387,12 @@
           } else {
             // Grow gaps.
             for (int k = 0; k < newLength; k += 1) {
-              _insertChild(startOld + k, newChildren[startNew + k]);
+              final MergeableMaterialItem newChild = newChildren[startNew + k];
 
-              if (newChildren[startNew + k] is MaterialGap) {
-                final MaterialGap gap = newChildren[startNew + k];
-                _animationTuples[gap.key].controller.forward();
+              _insertChild(startOld + k, newChild);
+
+              if (newChild is MaterialGap) {
+                _animationTuples[newChild.key].controller.forward();
               }
             }
 
@@ -404,9 +405,9 @@
             double gapSizeSum = 0.0;
 
             while (startOld < j) {
-              if (_children[startOld] is MaterialGap) {
-                final MaterialGap gap = _children[startOld];
-                gapSizeSum += gap.size;
+              final MergeableMaterialItem child = _children[startOld];
+              if (child is MaterialGap) {
+                gapSizeSum += child.size;
               }
 
               _removeChild(startOld);
@@ -428,7 +429,7 @@
             }
           } else if (oldLength == 1) {
             // Shrink gap.
-            final MaterialGap gap = _children[startOld];
+            final MaterialGap gap = _children[startOld] as MaterialGap;
             _animationTuples[gap.key].gapStart = 0.0;
             _animationTuples[gap.key].controller.reverse();
           }
@@ -498,7 +499,7 @@
   }
 
   double _getGapSize(int index) {
-    final MaterialGap gap = _children[index];
+    final MaterialGap gap = _children[index] as MaterialGap;
 
     return lerpDouble(
       _animationTuples[gap.key].gapStart,
@@ -548,7 +549,7 @@
           ),
         );
       } else {
-        final MaterialSlice slice = _children[i];
+        final MaterialSlice slice = _children[i] as MaterialSlice;
         Widget child = slice.child;
 
         if (widget.hasDividers) {
@@ -631,10 +632,8 @@
 
   @override
   bool operator ==(dynamic other) {
-    if (other is! _MergeableMaterialSliceKey)
-      return false;
-    final _MergeableMaterialSliceKey typedOther = other;
-    return value == typedOther.value;
+    return other is _MergeableMaterialSliceKey
+        && other.value == value;
   }
 
   @override
@@ -671,7 +670,7 @@
 
   @override
   void updateRenderObject(BuildContext context, RenderListBody renderObject) {
-    final _RenderMergeableMaterialListBody materialRenderListBody = renderObject;
+    final _RenderMergeableMaterialListBody materialRenderListBody = renderObject as _RenderMergeableMaterialListBody;
     materialRenderListBody
       ..axisDirection = _getDirection(context)
       ..boxShadows = boxShadows;
@@ -705,7 +704,7 @@
     int i = 0;
 
     while (child != null) {
-      final ListBodyParentData childParentData = child.parentData;
+      final ListBodyParentData childParentData = child.parentData as ListBodyParentData;
       final Rect rect = (childParentData.offset + offset) & child.size;
       if (i % 2 == 0)
         _paintShadows(context.canvas, rect);
diff --git a/packages/flutter/lib/src/material/outline_button.dart b/packages/flutter/lib/src/material/outline_button.dart
index ce46e99..0b8cd05 100644
--- a/packages/flutter/lib/src/material/outline_button.dart
+++ b/packages/flutter/lib/src/material/outline_button.dart
@@ -557,8 +557,9 @@
       return true;
     if (runtimeType != other.runtimeType)
       return false;
-    final _OutlineBorder typedOther = other;
-    return side == typedOther.side && shape == typedOther.shape;
+    return other is _OutlineBorder
+        && other.side == side
+        && other.shape == shape;
   }
 
   @override
diff --git a/packages/flutter/lib/src/material/page_transitions_theme.dart b/packages/flutter/lib/src/material/page_transitions_theme.dart
index 0281229..c50f5f6 100644
--- a/packages/flutter/lib/src/material/page_transitions_theme.dart
+++ b/packages/flutter/lib/src/material/page_transitions_theme.dart
@@ -534,10 +534,10 @@
       return true;
     if (other.runtimeType != runtimeType)
       return false;
-    final PageTransitionsTheme typedOther = other;
     if (identical(builders, other.builders))
       return true;
-    return listEquals<PageTransitionsBuilder>(_all(builders), _all(typedOther.builders));
+    return other is PageTransitionsTheme
+        && listEquals<PageTransitionsBuilder>(_all(other.builders), _all(builders));
   }
 
   @override
diff --git a/packages/flutter/lib/src/material/paginated_data_table.dart b/packages/flutter/lib/src/material/paginated_data_table.dart
index fc25db1..50147a4 100644
--- a/packages/flutter/lib/src/material/paginated_data_table.dart
+++ b/packages/flutter/lib/src/material/paginated_data_table.dart
@@ -226,7 +226,7 @@
   @override
   void initState() {
     super.initState();
-    _firstRowIndex = PageStorage.of(context)?.readState(context) ?? widget.initialFirstRowIndex ?? 0;
+    _firstRowIndex = PageStorage.of(context)?.readState(context) as int ?? widget.initialFirstRowIndex ?? 0;
     widget.source.addListener(_handleDataSourceChanged);
     _handleDataSourceChanged();
   }
@@ -382,7 +382,7 @@
             alignment: AlignmentDirectional.centerEnd,
             child: DropdownButtonHideUnderline(
               child: DropdownButton<int>(
-                items: availableRowsPerPage,
+                items: availableRowsPerPage.cast<DropdownMenuItem<int>>(),
                 value: widget.rowsPerPage,
                 onChanged: widget.onRowsPerPageChanged,
                 style: footerTextStyle,
diff --git a/packages/flutter/lib/src/material/popup_menu.dart b/packages/flutter/lib/src/material/popup_menu.dart
index d19f9cf..a04a8eb 100644
--- a/packages/flutter/lib/src/material/popup_menu.dart
+++ b/packages/flutter/lib/src/material/popup_menu.dart
@@ -159,7 +159,7 @@
       child.layout(constraints, parentUsesSize: true);
       size = constraints.constrain(child.size);
     }
-    final BoxParentData childParentData = child.parentData;
+    final BoxParentData childParentData = child.parentData as BoxParentData;
     childParentData.offset = Offset.zero;
     onLayout(size);
   }
@@ -490,7 +490,7 @@
 
     for (int i = 0; i < route.items.length; i += 1) {
       final double start = (i + 1) * unit;
-      final double end = (start + 1.5 * unit).clamp(0.0, 1.0);
+      final double end = (start + 1.5 * unit).clamp(0.0, 1.0) as double;
       final CurvedAnimation opacity = CurvedAnimation(
         parent: route.animation,
         curve: Interval(start, end),
@@ -591,7 +591,9 @@
   BoxConstraints getConstraintsForChild(BoxConstraints constraints) {
     // The menu can be at most the size of the overlay minus 8.0 pixels in each
     // direction.
-    return BoxConstraints.loose(constraints.biggest - const Offset(_kMenuScreenPadding * 2.0, _kMenuScreenPadding * 2.0));
+    return BoxConstraints.loose(
+      constraints.biggest - const Offset(_kMenuScreenPadding * 2.0, _kMenuScreenPadding * 2.0) as Size,
+    );
   }
 
   @override
@@ -677,7 +679,7 @@
   final RelativeRect position;
   final List<PopupMenuEntry<T>> items;
   final List<Size> itemSizes;
-  final dynamic initialValue;
+  final T initialValue;
   final double elevation;
   final ThemeData theme;
   final String semanticLabel;
@@ -1041,8 +1043,8 @@
 class _PopupMenuButtonState<T> extends State<PopupMenuButton<T>> {
   void showButtonMenu() {
     final PopupMenuThemeData popupMenuTheme = PopupMenuTheme.of(context);
-    final RenderBox button = context.findRenderObject();
-    final RenderBox overlay = Overlay.of(context).context.findRenderObject();
+    final RenderBox button = context.findRenderObject() as RenderBox;
+    final RenderBox overlay = Overlay.of(context).context.findRenderObject() as RenderBox;
     final RelativeRect position = RelativeRect.fromRect(
       Rect.fromPoints(
         button.localToGlobal(widget.offset, ancestor: overlay),
diff --git a/packages/flutter/lib/src/material/popup_menu_theme.dart b/packages/flutter/lib/src/material/popup_menu_theme.dart
index e7430df..45df407 100644
--- a/packages/flutter/lib/src/material/popup_menu_theme.dart
+++ b/packages/flutter/lib/src/material/popup_menu_theme.dart
@@ -99,11 +99,11 @@
       return true;
     if (other.runtimeType != runtimeType)
       return false;
-    final PopupMenuThemeData typedOther = other;
-    return typedOther.elevation == elevation
-        && typedOther.color == color
-        && typedOther.shape == shape
-        && typedOther.textStyle == textStyle;
+    return other is PopupMenuThemeData
+        && other.elevation == elevation
+        && other.color == color
+        && other.shape == shape
+        && other.textStyle == textStyle;
   }
 
   @override
diff --git a/packages/flutter/lib/src/material/progress_indicator.dart b/packages/flutter/lib/src/material/progress_indicator.dart
index 9b0b5b8..1e4b94e 100644
--- a/packages/flutter/lib/src/material/progress_indicator.dart
+++ b/packages/flutter/lib/src/material/progress_indicator.dart
@@ -181,7 +181,7 @@
     }
 
     if (value != null) {
-      drawBar(0.0, value.clamp(0.0, 1.0) * size.width);
+      drawBar(0.0, value.clamp(0.0, 1.0) * size.width as double);
     } else {
       final double x1 = size.width * line1Tail.transform(animationValue);
       final double width1 = size.width * line1Head.transform(animationValue) - x1;
@@ -331,7 +331,7 @@
          ? _startAngle
          : _startAngle + tailValue * 3 / 2 * math.pi + rotationValue * math.pi * 1.7 - stepValue * 0.8 * math.pi,
        arcSweep = value != null
-         ? value.clamp(0.0, 1.0) * _sweep
+         ? (value.clamp(0.0, 1.0) as double) * _sweep
          : math.max(headValue * 3 / 2 * math.pi - tailValue * 3 / 2 * math.pi, _epsilon);
 
   final Color backgroundColor;
@@ -646,7 +646,7 @@
 
   @override
   Widget _buildIndicator(BuildContext context, double headValue, double tailValue, int stepValue, double rotationValue) {
-    final double arrowheadScale = widget.value == null ? 0.0 : (widget.value * 2.0).clamp(0.0, 1.0);
+    final double arrowheadScale = widget.value == null ? 0.0 : ((widget.value * 2.0).clamp(0.0, 1.0) as double);
     return widget._buildSemanticsWrapper(
       context: context,
       child: Container(
diff --git a/packages/flutter/lib/src/material/range_slider.dart b/packages/flutter/lib/src/material/range_slider.dart
index af65f33..cc4589e 100644
--- a/packages/flutter/lib/src/material/range_slider.dart
+++ b/packages/flutter/lib/src/material/range_slider.dart
@@ -993,7 +993,7 @@
   }
 
   double _discretize(double value) {
-    double result = value.clamp(0.0, 1.0);
+    double result = value.clamp(0.0, 1.0) as double;
     if (isDiscrete) {
       result = (result * divisions).round() / divisions;
     }
@@ -1005,7 +1005,7 @@
   }
 
   void _startInteraction(Offset globalPosition) {
-    final double tapValue = _getValueFromGlobalPosition(globalPosition).clamp(0.0, 1.0);
+    final double tapValue = _getValueFromGlobalPosition(globalPosition).clamp(0.0, 1.0) as double;
     _lastThumbSelection = sliderTheme.thumbSelector(textDirection, values, tapValue, _thumbSize, size, 0);
 
     if (_lastThumbSelection != null) {
@@ -1408,10 +1408,10 @@
   }
 
   double _increaseValue(double value) {
-    return (value + _semanticActionUnit).clamp(0.0, 1.0);
+    return (value + _semanticActionUnit).clamp(0.0, 1.0) as double;
   }
 
   double _decreaseValue(double value) {
-    return (value - _semanticActionUnit).clamp(0.0, 1.0);
+    return (value - _semanticActionUnit).clamp(0.0, 1.0) as double;
   }
 }
diff --git a/packages/flutter/lib/src/material/refresh_indicator.dart b/packages/flutter/lib/src/material/refresh_indicator.dart
index 52b303b..b1363ac 100644
--- a/packages/flutter/lib/src/material/refresh_indicator.dart
+++ b/packages/flutter/lib/src/material/refresh_indicator.dart
@@ -304,7 +304,7 @@
     double newValue = _dragOffset / (containerExtent * _kDragContainerExtentPercentage);
     if (_mode == _RefreshIndicatorMode.armed)
       newValue = math.max(newValue, 1.0 / _kDragSizeFactorLimit);
-    _positionController.value = newValue.clamp(0.0, 1.0); // this triggers various rebuilds
+    _positionController.value = newValue.clamp(0.0, 1.0) as double; // this triggers various rebuilds
     if (_mode == _RefreshIndicatorMode.drag && _valueColor.value.alpha == 0xFF)
       _mode = _RefreshIndicatorMode.armed;
   }
diff --git a/packages/flutter/lib/src/material/scaffold.dart b/packages/flutter/lib/src/material/scaffold.dart
index 9576a80..25dc389 100644
--- a/packages/flutter/lib/src/material/scaffold.dart
+++ b/packages/flutter/lib/src/material/scaffold.dart
@@ -317,9 +317,9 @@
   bool operator ==(dynamic other) {
     if (super != other)
       return false;
-    final _BodyBoxConstraints typedOther = other;
-    return bottomWidgetsHeight == typedOther.bottomWidgetsHeight
-        && appBarHeight == typedOther.appBarHeight;
+    return other is _BodyBoxConstraints
+        && other.bottomWidgetsHeight == bottomWidgetsHeight
+        && other.appBarHeight == appBarHeight;
   }
 
   @override
@@ -356,7 +356,7 @@
 
     return LayoutBuilder(
       builder: (BuildContext context, BoxConstraints constraints) {
-        final _BodyBoxConstraints bodyConstraints = constraints;
+        final _BodyBoxConstraints bodyConstraints = constraints as _BodyBoxConstraints;
         final MediaQueryData metrics = MediaQuery.of(context);
 
         final double bottom = extendBody
@@ -741,10 +741,8 @@
   }
 
   bool _isExtendedFloatingActionButton(Widget widget) {
-    if (widget is! FloatingActionButton)
-      return false;
-    final FloatingActionButton fab = widget;
-    return fab.isExtended;
+    return widget is FloatingActionButton
+        && widget.isExtended;
   }
 
   @override
@@ -1897,7 +1895,7 @@
         clipBehavior: clipBehavior,
       );
     });
-    return _currentBottomSheet;
+    return _currentBottomSheet as PersistentBottomSheetController<T>;
   }
 
   // Floating Action Button API
@@ -1919,7 +1917,7 @@
     _floatingActionButtonVisibilityController.value = newValue.clamp(
       _floatingActionButtonVisibilityController.lowerBound,
       _floatingActionButtonVisibilityController.upperBound,
-    );
+    ) as double;
   }
 
   /// Shows the [Scaffold.floatingActionButton].
diff --git a/packages/flutter/lib/src/material/slider.dart b/packages/flutter/lib/src/material/slider.dart
index 1a805f8..17ec4a8 100644
--- a/packages/flutter/lib/src/material/slider.dart
+++ b/packages/flutter/lib/src/material/slider.dart
@@ -962,7 +962,7 @@
   }
 
   double _discretize(double value) {
-    double result = value.clamp(0.0, 1.0);
+    double result = value.clamp(0.0, 1.0) as double;
     if (isDiscrete) {
       result = (result * divisions).round() / divisions;
     }
@@ -1191,8 +1191,8 @@
       config.onDecrease = _decreaseAction;
       if (semanticFormatterCallback != null) {
         config.value = semanticFormatterCallback(_state._lerp(value));
-        config.increasedValue = semanticFormatterCallback(_state._lerp((value + _semanticActionUnit).clamp(0.0, 1.0)));
-        config.decreasedValue = semanticFormatterCallback(_state._lerp((value - _semanticActionUnit).clamp(0.0, 1.0)));
+        config.increasedValue = semanticFormatterCallback(_state._lerp((value + _semanticActionUnit).clamp(0.0, 1.0) as double));
+        config.decreasedValue = semanticFormatterCallback(_state._lerp((value - _semanticActionUnit).clamp(0.0, 1.0) as double));
       } else {
         config.value = '${(value * 100).round()}%';
         config.increasedValue = '${((value + _semanticActionUnit).clamp(0.0, 1.0) * 100).round()}%';
@@ -1205,13 +1205,13 @@
 
   void _increaseAction() {
     if (isInteractive) {
-      onChanged((value + _semanticActionUnit).clamp(0.0, 1.0));
+      onChanged((value + _semanticActionUnit).clamp(0.0, 1.0) as double);
     }
   }
 
   void _decreaseAction() {
     if (isInteractive) {
-      onChanged((value - _semanticActionUnit).clamp(0.0, 1.0));
+      onChanged((value - _semanticActionUnit).clamp(0.0, 1.0) as double);
     }
   }
 }
diff --git a/packages/flutter/lib/src/material/slider_theme.dart b/packages/flutter/lib/src/material/slider_theme.dart
index 3c573aa..a933dc4 100644
--- a/packages/flutter/lib/src/material/slider_theme.dart
+++ b/packages/flutter/lib/src/material/slider_theme.dart
@@ -780,34 +780,34 @@
     if (other.runtimeType != runtimeType) {
       return false;
     }
-    final SliderThemeData otherData = other;
-    return otherData.trackHeight == trackHeight
-      && otherData.activeTrackColor == activeTrackColor
-      && otherData.inactiveTrackColor == inactiveTrackColor
-      && otherData.disabledActiveTrackColor == disabledActiveTrackColor
-      && otherData.disabledInactiveTrackColor == disabledInactiveTrackColor
-      && otherData.activeTickMarkColor == activeTickMarkColor
-      && otherData.inactiveTickMarkColor == inactiveTickMarkColor
-      && otherData.disabledActiveTickMarkColor == disabledActiveTickMarkColor
-      && otherData.disabledInactiveTickMarkColor == disabledInactiveTickMarkColor
-      && otherData.thumbColor == thumbColor
-      && otherData.overlappingShapeStrokeColor == overlappingShapeStrokeColor
-      && otherData.disabledThumbColor == disabledThumbColor
-      && otherData.overlayColor == overlayColor
-      && otherData.valueIndicatorColor == valueIndicatorColor
-      && otherData.overlayShape == overlayShape
-      && otherData.tickMarkShape == tickMarkShape
-      && otherData.thumbShape == thumbShape
-      && otherData.trackShape == trackShape
-      && otherData.valueIndicatorShape == valueIndicatorShape
-      && otherData.rangeTickMarkShape == rangeTickMarkShape
-      && otherData.rangeThumbShape == rangeThumbShape
-      && otherData.rangeTrackShape == rangeTrackShape
-      && otherData.rangeValueIndicatorShape == rangeValueIndicatorShape
-      && otherData.showValueIndicator == showValueIndicator
-      && otherData.valueIndicatorTextStyle == valueIndicatorTextStyle
-      && otherData.minThumbSeparation == minThumbSeparation
-      && otherData.thumbSelector == thumbSelector;
+    return other is SliderThemeData
+        && other.trackHeight == trackHeight
+        && other.activeTrackColor == activeTrackColor
+        && other.inactiveTrackColor == inactiveTrackColor
+        && other.disabledActiveTrackColor == disabledActiveTrackColor
+        && other.disabledInactiveTrackColor == disabledInactiveTrackColor
+        && other.activeTickMarkColor == activeTickMarkColor
+        && other.inactiveTickMarkColor == inactiveTickMarkColor
+        && other.disabledActiveTickMarkColor == disabledActiveTickMarkColor
+        && other.disabledInactiveTickMarkColor == disabledInactiveTickMarkColor
+        && other.thumbColor == thumbColor
+        && other.overlappingShapeStrokeColor == overlappingShapeStrokeColor
+        && other.disabledThumbColor == disabledThumbColor
+        && other.overlayColor == overlayColor
+        && other.valueIndicatorColor == valueIndicatorColor
+        && other.overlayShape == overlayShape
+        && other.tickMarkShape == tickMarkShape
+        && other.thumbShape == thumbShape
+        && other.trackShape == trackShape
+        && other.valueIndicatorShape == valueIndicatorShape
+        && other.rangeTickMarkShape == rangeTickMarkShape
+        && other.rangeThumbShape == rangeThumbShape
+        && other.rangeTrackShape == rangeTrackShape
+        && other.rangeValueIndicatorShape == rangeValueIndicatorShape
+        && other.showValueIndicator == showValueIndicator
+        && other.valueIndicatorTextStyle == valueIndicatorTextStyle
+        && other.minThumbSeparation == minThumbSeparation
+        && other.thumbSelector == thumbSelector;
   }
 
   @override
@@ -2768,8 +2768,8 @@
     // the top neck arc. We use this to shrink/expand it based on the scale
     // factor of the value indicator.
     final double neckStretchBaseline = math.max(0.0, rightBottomNeckCenterY - math.max(leftTopNeckCenter.dy, neckRightCenter.dy));
-    final double t = math.pow(inverseTextScale, 3.0);
-    final double stretch = (neckStretchBaseline * t).clamp(0.0, 10.0 * neckStretchBaseline);
+    final double t = math.pow(inverseTextScale, 3.0) as double;
+    final double stretch = (neckStretchBaseline * t).clamp(0.0, 10.0 * neckStretchBaseline) as double;
     final Offset neckStretch = Offset(0.0, neckStretchBaseline - stretch);
 
     assert(!_debuggingLabelLocation || () {
@@ -2886,9 +2886,9 @@
   bool operator ==(Object other) {
     if (other.runtimeType != runtimeType)
       return false;
-    final RangeValues typedOther = other;
-    return typedOther.start == start
-        && typedOther.end == end;
+    return other is RangeValues
+        && other.start == start
+        && other.end == end;
   }
 
   @override
@@ -2925,9 +2925,9 @@
   bool operator ==(Object other) {
     if (other.runtimeType != runtimeType)
       return false;
-    final RangeLabels typedOther = other;
-    return typedOther.start == start
-        && typedOther.end == end;
+    return other is RangeLabels
+        && other.start == start
+        && other.end == end;
   }
 
   @override
diff --git a/packages/flutter/lib/src/material/snack_bar_theme.dart b/packages/flutter/lib/src/material/snack_bar_theme.dart
index e0ae743..a5281f0 100644
--- a/packages/flutter/lib/src/material/snack_bar_theme.dart
+++ b/packages/flutter/lib/src/material/snack_bar_theme.dart
@@ -161,14 +161,14 @@
       return true;
     if (other.runtimeType != runtimeType)
       return false;
-    final SnackBarThemeData typedOther = other;
-    return typedOther.backgroundColor == backgroundColor
-        && typedOther.actionTextColor == actionTextColor
-        && typedOther.disabledActionTextColor == disabledActionTextColor
-        && typedOther.contentTextStyle == contentTextStyle
-        && typedOther.elevation == elevation
-        && typedOther.shape == shape
-        && typedOther.behavior == behavior;
+    return other is SnackBarThemeData
+        && other.backgroundColor == backgroundColor
+        && other.actionTextColor == actionTextColor
+        && other.disabledActionTextColor == disabledActionTextColor
+        && other.contentTextStyle == contentTextStyle
+        && other.elevation == elevation
+        && other.shape == shape
+        && other.behavior == behavior;
   }
 
   @override
diff --git a/packages/flutter/lib/src/material/tab_bar_theme.dart b/packages/flutter/lib/src/material/tab_bar_theme.dart
index 5da835f..69963d8 100644
--- a/packages/flutter/lib/src/material/tab_bar_theme.dart
+++ b/packages/flutter/lib/src/material/tab_bar_theme.dart
@@ -96,7 +96,7 @@
       indicator: Decoration.lerp(a.indicator, b.indicator, t),
       indicatorSize: t < 0.5 ? a.indicatorSize : b.indicatorSize,
       labelColor: Color.lerp(a.labelColor, b.labelColor, t),
-      labelPadding: EdgeInsets.lerp(a.labelPadding, b.labelPadding, t),
+      labelPadding: EdgeInsetsGeometry.lerp(a.labelPadding, b.labelPadding, t),
       labelStyle: TextStyle.lerp(a.labelStyle, b.labelStyle, t),
       unselectedLabelColor: Color.lerp(a.unselectedLabelColor, b.unselectedLabelColor, t),
       unselectedLabelStyle: TextStyle.lerp(a.unselectedLabelStyle, b.unselectedLabelStyle, t),
@@ -122,13 +122,13 @@
       return true;
     if (other.runtimeType != runtimeType)
       return false;
-    final TabBarTheme typedOther = other;
-    return typedOther.indicator == indicator
-        && typedOther.indicatorSize == indicatorSize
-        && typedOther.labelColor == labelColor
-        && typedOther.labelPadding == labelPadding
-        && typedOther.labelStyle == labelStyle
-        && typedOther.unselectedLabelColor == unselectedLabelColor
-        && typedOther.unselectedLabelStyle == unselectedLabelStyle;
+    return other is TabBarTheme
+        && other.indicator == indicator
+        && other.indicatorSize == indicatorSize
+        && other.labelColor == labelColor
+        && other.labelPadding == labelPadding
+        && other.labelStyle == labelStyle
+        && other.unselectedLabelColor == unselectedLabelColor
+        && other.unselectedLabelStyle == unselectedLabelStyle;
   }
 }
diff --git a/packages/flutter/lib/src/material/tabs.dart b/packages/flutter/lib/src/material/tabs.dart
index 28973bf..2f98945 100644
--- a/packages/flutter/lib/src/material/tabs.dart
+++ b/packages/flutter/lib/src/material/tabs.dart
@@ -156,7 +156,7 @@
   Widget build(BuildContext context) {
     final ThemeData themeData = Theme.of(context);
     final TabBarTheme tabBarTheme = TabBarTheme.of(context);
-    final Animation<double> animation = listenable;
+    final Animation<double> animation = listenable as Animation<double>;
 
     // To enable TextStyle.lerp(style1, style2, value), both styles must have
     // the same value of inherit. Force that to be inherit=true here.
@@ -232,7 +232,7 @@
     RenderBox child = firstChild;
     final List<double> xOffsets = <double>[];
     while (child != null) {
-      final FlexParentData childParentData = child.parentData;
+      final FlexParentData childParentData = child.parentData as FlexParentData;
       xOffsets.add(childParentData.offset.dx);
       assert(child.parentData == childParentData);
       child = childParentData.nextSibling;
@@ -298,7 +298,7 @@
   // The controller's offset is changing because the user is dragging the
   // TabBarView's PageView to the left or right.
   if (!controller.indexIsChanging)
-    return (currentIndex - controllerValue).abs().clamp(0.0, 1.0);
+    return (currentIndex - controllerValue).abs().clamp(0.0, 1.0) as double;
 
   // The TabController animation's value is changing from previousIndex to currentIndex.
   return (controllerValue - currentIndex).abs() / (currentIndex - previousIndex).abs();
@@ -489,7 +489,7 @@
   @override
   double get value {
     assert(!controller.indexIsChanging);
-    return (controller.animation.value - index.toDouble()).abs().clamp(0.0, 1.0);
+    return (controller.animation.value - index.toDouble()).abs().clamp(0.0, 1.0) as double;
   }
 }
 
@@ -900,7 +900,7 @@
       case TextDirection.ltr:
         break;
     }
-    return (tabCenter - viewportWidth / 2.0).clamp(minExtent, maxExtent);
+    return (tabCenter - viewportWidth / 2.0).clamp(minExtent, maxExtent) as double;
   }
 
   double _tabCenteredScrollOffset(int index) {
@@ -1302,7 +1302,7 @@
         _controller.index = _pageController.page.floor();
         _currentIndex =_controller.index;
       }
-      _controller.offset = (_pageController.page - _controller.index).clamp(-1.0, 1.0);
+      _controller.offset = (_pageController.page - _controller.index).clamp(-1.0, 1.0) as double;
     } else if (notification is ScrollEndNotification) {
       _controller.index = _pageController.page.round();
       _currentIndex = _controller.index;
diff --git a/packages/flutter/lib/src/material/text_field.dart b/packages/flutter/lib/src/material/text_field.dart
index c7fa57e..6de97f7 100644
--- a/packages/flutter/lib/src/material/text_field.dart
+++ b/packages/flutter/lib/src/material/text_field.dart
@@ -782,7 +782,7 @@
     if (widget.maxLength > 0) {
       // Show the maxLength in the counter
       counterText += '/${widget.maxLength}';
-      final int remaining = (widget.maxLength - currentLength).clamp(0, widget.maxLength);
+      final int remaining = (widget.maxLength - currentLength).clamp(0, widget.maxLength) as int;
       semanticCounterText = localizations.remainingTextFieldCharacterCount(remaining);
 
       // Handle length exceeds maxLength
diff --git a/packages/flutter/lib/src/material/text_form_field.dart b/packages/flutter/lib/src/material/text_form_field.dart
index 21b703c..b4bba24 100644
--- a/packages/flutter/lib/src/material/text_form_field.dart
+++ b/packages/flutter/lib/src/material/text_form_field.dart
@@ -152,7 +152,7 @@
     autovalidate: autovalidate,
     enabled: enabled,
     builder: (FormFieldState<String> field) {
-      final _TextFormFieldState state = field;
+      final _TextFormFieldState state = field as _TextFormFieldState;
       final InputDecoration effectiveDecoration = (decoration ?? const InputDecoration())
         .applyDefaults(Theme.of(field.context).inputDecorationTheme);
       void onChangedHandler(String value) {
@@ -218,7 +218,7 @@
   TextEditingController get _effectiveController => widget.controller ?? _controller;
 
   @override
-  TextFormField get widget => super.widget;
+  TextFormField get widget => super.widget as TextFormField;
 
   @override
   void initState() {
diff --git a/packages/flutter/lib/src/material/text_theme.dart b/packages/flutter/lib/src/material/text_theme.dart
index 98b6a6c..afa92bf 100644
--- a/packages/flutter/lib/src/material/text_theme.dart
+++ b/packages/flutter/lib/src/material/text_theme.dart
@@ -481,20 +481,20 @@
       return true;
     if (other.runtimeType != runtimeType)
       return false;
-    final TextTheme typedOther = other;
-    return display4 == typedOther.display4
-        && display3 == typedOther.display3
-        && display2 == typedOther.display2
-        && display1 == typedOther.display1
-        && headline == typedOther.headline
-        && title == typedOther.title
-        && subhead == typedOther.subhead
-        && body2 == typedOther.body2
-        && body1 == typedOther.body1
-        && caption == typedOther.caption
-        && button == typedOther.button
-        && subtitle == typedOther.subtitle
-        && overline == typedOther.overline;
+    return other is TextTheme
+        && other.display4 == display4
+        && other.display3 == display3
+        && other.display2 == display2
+        && other.display1 == display1
+        && other.headline == headline
+        && other.title == title
+        && other.subhead == subhead
+        && other.body2 == body2
+        && other.body1 == body1
+        && other.caption == caption
+        && other.button == button
+        && other.subtitle == subtitle
+        && other.overline == overline;
   }
 
   @override
diff --git a/packages/flutter/lib/src/material/theme.dart b/packages/flutter/lib/src/material/theme.dart
index 812cc2d..9c2c922 100644
--- a/packages/flutter/lib/src/material/theme.dart
+++ b/packages/flutter/lib/src/material/theme.dart
@@ -254,7 +254,7 @@
   @override
   void forEachTween(TweenVisitor<dynamic> visitor) {
     // TODO(ianh): Use constructor tear-offs when it becomes possible
-    _data = visitor(_data, widget.data, (dynamic value) => ThemeDataTween(begin: value));
+    _data = visitor(_data, widget.data, (dynamic value) => ThemeDataTween(begin: value as ThemeData)) as ThemeDataTween;
     assert(_data != null);
   }
 
diff --git a/packages/flutter/lib/src/material/theme_data.dart b/packages/flutter/lib/src/material/theme_data.dart
index e642a19..e151810 100644
--- a/packages/flutter/lib/src/material/theme_data.dart
+++ b/packages/flutter/lib/src/material/theme_data.dart
@@ -1297,71 +1297,71 @@
   bool operator ==(Object other) {
     if (other.runtimeType != runtimeType)
       return false;
-    final ThemeData otherData = other;
     // Warning: make sure these properties are in the exact same order as in
     // hashValues() and in the raw constructor and in the order of fields in
     // the class and in the lerp() method.
-    return (otherData.brightness == brightness) &&
-           (otherData.visualDensity == visualDensity) &&
-           (otherData.primaryColor == primaryColor) &&
-           (otherData.primaryColorBrightness == primaryColorBrightness) &&
-           (otherData.primaryColorLight == primaryColorLight) &&
-           (otherData.primaryColorDark == primaryColorDark) &&
-           (otherData.accentColor == accentColor) &&
-           (otherData.accentColorBrightness == accentColorBrightness) &&
-           (otherData.canvasColor == canvasColor) &&
-           (otherData.scaffoldBackgroundColor == scaffoldBackgroundColor) &&
-           (otherData.bottomAppBarColor == bottomAppBarColor) &&
-           (otherData.cardColor == cardColor) &&
-           (otherData.dividerColor == dividerColor) &&
-           (otherData.highlightColor == highlightColor) &&
-           (otherData.splashColor == splashColor) &&
-           (otherData.splashFactory == splashFactory) &&
-           (otherData.selectedRowColor == selectedRowColor) &&
-           (otherData.unselectedWidgetColor == unselectedWidgetColor) &&
-           (otherData.disabledColor == disabledColor) &&
-           (otherData.buttonTheme == buttonTheme) &&
-           (otherData.buttonColor == buttonColor) &&
-           (otherData.toggleButtonsTheme == toggleButtonsTheme) &&
-           (otherData.secondaryHeaderColor == secondaryHeaderColor) &&
-           (otherData.textSelectionColor == textSelectionColor) &&
-           (otherData.cursorColor == cursorColor) &&
-           (otherData.textSelectionHandleColor == textSelectionHandleColor) &&
-           (otherData.backgroundColor == backgroundColor) &&
-           (otherData.dialogBackgroundColor == dialogBackgroundColor) &&
-           (otherData.indicatorColor == indicatorColor) &&
-           (otherData.hintColor == hintColor) &&
-           (otherData.errorColor == errorColor) &&
-           (otherData.toggleableActiveColor == toggleableActiveColor) &&
-           (otherData.textTheme == textTheme) &&
-           (otherData.primaryTextTheme == primaryTextTheme) &&
-           (otherData.accentTextTheme == accentTextTheme) &&
-           (otherData.inputDecorationTheme == inputDecorationTheme) &&
-           (otherData.iconTheme == iconTheme) &&
-           (otherData.primaryIconTheme == primaryIconTheme) &&
-           (otherData.accentIconTheme == accentIconTheme) &&
-           (otherData.sliderTheme == sliderTheme) &&
-           (otherData.tabBarTheme == tabBarTheme) &&
-           (otherData.tooltipTheme == tooltipTheme) &&
-           (otherData.cardTheme == cardTheme) &&
-           (otherData.chipTheme == chipTheme) &&
-           (otherData.platform == platform) &&
-           (otherData.materialTapTargetSize == materialTapTargetSize) &&
-           (otherData.applyElevationOverlayColor == applyElevationOverlayColor) &&
-           (otherData.pageTransitionsTheme == pageTransitionsTheme) &&
-           (otherData.appBarTheme == appBarTheme) &&
-           (otherData.bottomAppBarTheme == bottomAppBarTheme) &&
-           (otherData.colorScheme == colorScheme) &&
-           (otherData.dialogTheme == dialogTheme) &&
-           (otherData.floatingActionButtonTheme == floatingActionButtonTheme) &&
-           (otherData.typography == typography) &&
-           (otherData.cupertinoOverrideTheme == cupertinoOverrideTheme) &&
-           (otherData.snackBarTheme == snackBarTheme) &&
-           (otherData.bottomSheetTheme == bottomSheetTheme) &&
-           (otherData.popupMenuTheme == popupMenuTheme) &&
-           (otherData.bannerTheme == bannerTheme) &&
-           (otherData.dividerTheme == dividerTheme) &&
-           (otherData.buttonBarTheme == buttonBarTheme);
+    return other is ThemeData
+        && other.brightness == brightness
+        && other.visualDensity == visualDensity
+        && other.primaryColor == primaryColor
+        && other.primaryColorBrightness == primaryColorBrightness
+        && other.primaryColorLight == primaryColorLight
+        && other.primaryColorDark == primaryColorDark
+        && other.accentColor == accentColor
+        && other.accentColorBrightness == accentColorBrightness
+        && other.canvasColor == canvasColor
+        && other.scaffoldBackgroundColor == scaffoldBackgroundColor
+        && other.bottomAppBarColor == bottomAppBarColor
+        && other.cardColor == cardColor
+        && other.dividerColor == dividerColor
+        && other.highlightColor == highlightColor
+        && other.splashColor == splashColor
+        && other.splashFactory == splashFactory
+        && other.selectedRowColor == selectedRowColor
+        && other.unselectedWidgetColor == unselectedWidgetColor
+        && other.disabledColor == disabledColor
+        && other.buttonTheme == buttonTheme
+        && other.buttonColor == buttonColor
+        && other.toggleButtonsTheme == toggleButtonsTheme
+        && other.secondaryHeaderColor == secondaryHeaderColor
+        && other.textSelectionColor == textSelectionColor
+        && other.cursorColor == cursorColor
+        && other.textSelectionHandleColor == textSelectionHandleColor
+        && other.backgroundColor == backgroundColor
+        && other.dialogBackgroundColor == dialogBackgroundColor
+        && other.indicatorColor == indicatorColor
+        && other.hintColor == hintColor
+        && other.errorColor == errorColor
+        && other.toggleableActiveColor == toggleableActiveColor
+        && other.textTheme == textTheme
+        && other.primaryTextTheme == primaryTextTheme
+        && other.accentTextTheme == accentTextTheme
+        && other.inputDecorationTheme == inputDecorationTheme
+        && other.iconTheme == iconTheme
+        && other.primaryIconTheme == primaryIconTheme
+        && other.accentIconTheme == accentIconTheme
+        && other.sliderTheme == sliderTheme
+        && other.tabBarTheme == tabBarTheme
+        && other.tooltipTheme == tooltipTheme
+        && other.cardTheme == cardTheme
+        && other.chipTheme == chipTheme
+        && other.platform == platform
+        && other.materialTapTargetSize == materialTapTargetSize
+        && other.applyElevationOverlayColor == applyElevationOverlayColor
+        && other.pageTransitionsTheme == pageTransitionsTheme
+        && other.appBarTheme == appBarTheme
+        && other.bottomAppBarTheme == bottomAppBarTheme
+        && other.colorScheme == colorScheme
+        && other.dialogTheme == dialogTheme
+        && other.floatingActionButtonTheme == floatingActionButtonTheme
+        && other.typography == typography
+        && other.cupertinoOverrideTheme == cupertinoOverrideTheme
+        && other.snackBarTheme == snackBarTheme
+        && other.bottomSheetTheme == bottomSheetTheme
+        && other.popupMenuTheme == popupMenuTheme
+        && other.bannerTheme == bannerTheme
+        && other.dividerTheme == dividerTheme
+        && other.buttonBarTheme == buttonBarTheme;
   }
 
   @override
@@ -1636,8 +1636,9 @@
   bool operator ==(Object other) {
     // We are explicitly ignoring the possibility that the types might not
     // match in the interests of speed.
-    final _IdentityThemeDataCacheKey otherKey = other;
-    return identical(baseTheme, otherKey.baseTheme) && identical(localTextGeometry, otherKey.localTextGeometry);
+    return other is _IdentityThemeDataCacheKey
+        && identical(other.baseTheme, baseTheme)
+        && identical(other.localTextGeometry, localTextGeometry);
   }
 }
 
@@ -1819,9 +1820,9 @@
     if (other.runtimeType != runtimeType) {
       return false;
     }
-    final VisualDensity typedOther = other;
-    return horizontal == typedOther.horizontal
-        && vertical == typedOther.vertical;
+    return other is VisualDensity
+        && other.horizontal == horizontal
+        && other.vertical == vertical;
   }
 
   @override
diff --git a/packages/flutter/lib/src/material/time.dart b/packages/flutter/lib/src/material/time.dart
index 5a31cc6..011895b 100644
--- a/packages/flutter/lib/src/material/time.dart
+++ b/packages/flutter/lib/src/material/time.dart
@@ -113,11 +113,9 @@
 
   @override
   bool operator ==(dynamic other) {
-    if (other is! TimeOfDay)
-      return false;
-    final TimeOfDay typedOther = other;
-    return typedOther.hour == hour
-        && typedOther.minute == minute;
+    return other is TimeOfDay
+        && other.hour == hour
+        && other.minute == minute;
   }
 
   @override
diff --git a/packages/flutter/lib/src/material/time_picker.dart b/packages/flutter/lib/src/material/time_picker.dart
index a802ed2..b02f691 100644
--- a/packages/flutter/lib/src/material/time_picker.dart
+++ b/packages/flutter/lib/src/material/time_picker.dart
@@ -1004,7 +1004,7 @@
         final double width = labelPainter.width * _semanticNodeSizeScale;
         final double height = labelPainter.height * _semanticNodeSizeScale;
         final Offset nodeOffset = getOffsetForTheta(labelTheta, ring) + Offset(-width / 2.0, -height / 2.0);
-        final TextSpan textSpan = labelPainter.text;
+        final TextSpan textSpan = labelPainter.text as TextSpan;
         final CustomPainterSemantics node = CustomPainterSemantics(
           rect: Rect.fromLTRB(
             nodeOffset.dx - 24.0 + width / 2,
@@ -1190,7 +1190,7 @@
       _thetaTween
         ..begin = angle
         ..end = angle; // The controller doesn't animate during the pan gesture.
-      final RenderBox box = context.findRenderObject();
+      final RenderBox box = context.findRenderObject() as RenderBox;
       final double radius = box.size.shortestSide / 2.0;
       if (widget.mode == _TimePickerMode.hour && widget.use24HourDials) {
         if (offset.distance * 1.5 < radius)
@@ -1208,7 +1208,7 @@
   void _handlePanStart(DragStartDetails details) {
     assert(!_dragging);
     _dragging = true;
-    final RenderBox box = context.findRenderObject();
+    final RenderBox box = context.findRenderObject() as RenderBox;
     _position = box.globalToLocal(details.globalPosition);
     _center = box.size.center(Offset.zero);
     _updateThetaForPan();
@@ -1235,7 +1235,7 @@
   }
 
   void _handleTapUp(TapUpDetails details) {
-    final RenderBox box = context.findRenderObject();
+    final RenderBox box = context.findRenderObject() as RenderBox;
     _position = box.globalToLocal(details.globalPosition);
     _center = box.size.center(Offset.zero);
     _updateThetaForPan();
diff --git a/packages/flutter/lib/src/material/toggle_buttons.dart b/packages/flutter/lib/src/material/toggle_buttons.dart
index d88f2dc..4c1d4ee 100644
--- a/packages/flutter/lib/src/material/toggle_buttons.dart
+++ b/packages/flutter/lib/src/material/toggle_buttons.dart
@@ -1061,7 +1061,7 @@
         );
 
         child.layout(innerConstraints, parentUsesSize: true);
-        final BoxParentData childParentData = child.parentData;
+        final BoxParentData childParentData = child.parentData as BoxParentData;
         childParentData.offset = Offset(leadingBorderSide.width, leadingBorderSide.width);
 
         size = constraints.constrain(Size(
@@ -1083,7 +1083,7 @@
         );
 
         child.layout(innerConstraints, parentUsesSize: true);
-        final BoxParentData childParentData = child.parentData;
+        final BoxParentData childParentData = child.parentData as BoxParentData;
 
         if (isLastButton) {
           childParentData.offset = Offset(trailingBorderOffset, trailingBorderOffset);
diff --git a/packages/flutter/lib/src/material/toggle_buttons_theme.dart b/packages/flutter/lib/src/material/toggle_buttons_theme.dart
index 1f4da2a..c4d4b3f 100644
--- a/packages/flutter/lib/src/material/toggle_buttons_theme.dart
+++ b/packages/flutter/lib/src/material/toggle_buttons_theme.dart
@@ -195,22 +195,22 @@
       return true;
     if (other.runtimeType != runtimeType)
       return false;
-    final ToggleButtonsThemeData typedOther = other;
-    return typedOther.textStyle == textStyle
-        && typedOther.constraints == constraints
-        && typedOther.color == color
-        && typedOther.selectedColor == selectedColor
-        && typedOther.disabledColor == disabledColor
-        && typedOther.fillColor == fillColor
-        && typedOther.focusColor == focusColor
-        && typedOther.highlightColor == highlightColor
-        && typedOther.hoverColor == hoverColor
-        && typedOther.splashColor == splashColor
-        && typedOther.borderColor == borderColor
-        && typedOther.selectedBorderColor == selectedBorderColor
-        && typedOther.disabledBorderColor == disabledBorderColor
-        && typedOther.borderRadius == borderRadius
-        && typedOther.borderWidth == borderWidth;
+    return other is ToggleButtonsThemeData
+        && other.textStyle == textStyle
+        && other.constraints == constraints
+        && other.color == color
+        && other.selectedColor == selectedColor
+        && other.disabledColor == disabledColor
+        && other.fillColor == fillColor
+        && other.focusColor == focusColor
+        && other.highlightColor == highlightColor
+        && other.hoverColor == hoverColor
+        && other.splashColor == splashColor
+        && other.borderColor == borderColor
+        && other.selectedBorderColor == selectedBorderColor
+        && other.disabledBorderColor == disabledBorderColor
+        && other.borderRadius == borderRadius
+        && other.borderWidth == borderWidth;
   }
 
   @override
diff --git a/packages/flutter/lib/src/material/tooltip.dart b/packages/flutter/lib/src/material/tooltip.dart
index 4dd4e78..792852d 100644
--- a/packages/flutter/lib/src/material/tooltip.dart
+++ b/packages/flutter/lib/src/material/tooltip.dart
@@ -280,7 +280,7 @@
   }
 
   void _createNewEntry() {
-    final RenderBox box = context.findRenderObject();
+    final RenderBox box = context.findRenderObject() as RenderBox;
     final Offset target = box.localToGlobal(box.size.center(Offset.zero));
 
     // We create this widget outside of the overlay entry's builder to prevent
diff --git a/packages/flutter/lib/src/material/tooltip_theme.dart b/packages/flutter/lib/src/material/tooltip_theme.dart
index a9e6fa5..51ac275 100644
--- a/packages/flutter/lib/src/material/tooltip_theme.dart
+++ b/packages/flutter/lib/src/material/tooltip_theme.dart
@@ -122,8 +122,8 @@
     assert(t != null);
     return TooltipThemeData(
       height: lerpDouble(a?.height, b?.height, t),
-      padding: EdgeInsets.lerp(a?.padding, b?.padding, t),
-      margin: EdgeInsets.lerp(a?.margin, b?.margin, t),
+      padding: EdgeInsetsGeometry.lerp(a?.padding, b?.padding, t),
+      margin: EdgeInsetsGeometry.lerp(a?.margin, b?.margin, t),
       verticalOffset: lerpDouble(a?.verticalOffset, b?.verticalOffset, t),
       preferBelow: t < 0.5 ? a.preferBelow: b.preferBelow,
       excludeFromSemantics: t < 0.5 ? a.excludeFromSemantics : b.excludeFromSemantics,
@@ -154,17 +154,17 @@
       return true;
     if (other.runtimeType != runtimeType)
       return false;
-    final TooltipThemeData typedOther = other;
-    return typedOther.height == height
-        && typedOther.padding == padding
-        && typedOther.margin == margin
-        && typedOther.verticalOffset == verticalOffset
-        && typedOther.preferBelow == preferBelow
-        && typedOther.excludeFromSemantics == excludeFromSemantics
-        && typedOther.decoration == decoration
-        && typedOther.textStyle == textStyle
-        && typedOther.waitDuration == waitDuration
-        && typedOther.showDuration == showDuration;
+    return other is TooltipThemeData
+        && other.height == height
+        && other.padding == padding
+        && other.margin == margin
+        && other.verticalOffset == verticalOffset
+        && other.preferBelow == preferBelow
+        && other.excludeFromSemantics == excludeFromSemantics
+        && other.decoration == decoration
+        && other.textStyle == textStyle
+        && other.waitDuration == waitDuration
+        && other.showDuration == showDuration;
   }
 
   @override
diff --git a/packages/flutter/lib/src/material/typography.dart b/packages/flutter/lib/src/material/typography.dart
index b44ab33..03ab550 100644
--- a/packages/flutter/lib/src/material/typography.dart
+++ b/packages/flutter/lib/src/material/typography.dart
@@ -234,12 +234,12 @@
       return true;
     if (other.runtimeType != runtimeType)
       return false;
-    final Typography otherTypography = other;
-    return otherTypography.black == black
-        && otherTypography.white == white
-        && otherTypography.englishLike == englishLike
-        && otherTypography.dense == dense
-        && otherTypography.tall == tall;
+    return other is Typography
+        && other.black == black
+        && other.white == white
+        && other.englishLike == englishLike
+        && other.dense == dense
+        && other.tall == tall;
   }
 
   @override
diff --git a/packages/flutter/lib/src/material/user_accounts_drawer_header.dart b/packages/flutter/lib/src/material/user_accounts_drawer_header.dart
index 9108d29..13e61e3 100644
--- a/packages/flutter/lib/src/material/user_accounts_drawer_header.dart
+++ b/packages/flutter/lib/src/material/user_accounts_drawer_header.dart
@@ -232,7 +232,7 @@
     final String bottomLine = hasChild(accountEmail) ? accountEmail : (hasChild(accountName) ? accountName : null);
 
     if (bottomLine != null) {
-      final Size constraintSize = iconSize == null ? size : size - Offset(iconSize.width, 0.0);
+      final Size constraintSize = iconSize == null ? size : Size(size.width - iconSize.width, size.height);
       iconSize ??= const Size(_kAccountDetailsHeight, _kAccountDetailsHeight);
 
       // place bottom line center at same height as icon center
