Unverified Commit 2edb685b authored by xubaolin's avatar xubaolin Committed by GitHub

Use Object? instead of dynamic for Element slots (#78928)

parent 975fb0f0
......@@ -489,7 +489,7 @@ class _CupertinoAlertRenderElement extends RenderObjectElement {
}
@override
void mount(Element? parent, dynamic newSlot) {
void mount(Element? parent, Object? newSlot) {
super.mount(parent, newSlot);
_contentElement = updateChild(_contentElement,
widget.contentSection, _AlertSections.contentSection);
......
......@@ -389,7 +389,7 @@ class _CupertinoDialogRenderElement extends RenderObjectElement {
}
@override
void mount(Element? parent, dynamic newSlot) {
void mount(Element? parent, Object? newSlot) {
super.mount(parent, newSlot);
_contentElement = updateChild(_contentElement, widget.contentSection, _AlertDialogSections.contentSection);
_actionsElement = updateChild(_actionsElement, widget.actionsSection, _AlertDialogSections.actionsSection);
......
......@@ -535,7 +535,7 @@ class _CupertinoTextSelectionToolbarItemsElement extends RenderObjectElement {
}
@override
void insertRenderObjectChild(RenderObject child, dynamic slot) {
void insertRenderObjectChild(RenderObject child, Object? slot) {
if (slot is _CupertinoTextSelectionToolbarItemsSlot) {
assert(child is RenderBox);
_updateRenderObject(child as RenderBox, slot);
......@@ -562,7 +562,7 @@ class _CupertinoTextSelectionToolbarItemsElement extends RenderObjectElement {
}
@override
void removeRenderObjectChild(RenderObject child, dynamic slot) {
void removeRenderObjectChild(RenderObject child, Object? slot) {
// Check if the child is in a slot.
if (slot is _CupertinoTextSelectionToolbarItemsSlot) {
assert(child is RenderBox);
......@@ -614,7 +614,7 @@ class _CupertinoTextSelectionToolbarItemsElement extends RenderObjectElement {
}
@override
void mount(Element? parent, dynamic newSlot) {
void mount(Element? parent, Object? newSlot) {
super.mount(parent, newSlot);
// Mount slotted children.
_mountChild(widget.backButton, _CupertinoTextSelectionToolbarItemsSlot.backButton);
......
......@@ -2189,7 +2189,7 @@ class _RenderChipElement extends RenderObjectElement {
}
@override
void mount(Element? parent, dynamic newSlot) {
void mount(Element? parent, Object? newSlot) {
super.mount(parent, newSlot);
_mountChild(widget.theme.avatar, _ChipSlot.avatar);
_mountChild(widget.theme.deleteIcon, _ChipSlot.deleteIcon);
......@@ -2246,7 +2246,7 @@ class _RenderChipElement extends RenderObjectElement {
}
@override
void moveRenderObjectChild(RenderObject child, dynamic oldSlot, dynamic newSlot) {
void moveRenderObjectChild(RenderObject child, Object? oldSlot, Object? newSlot) {
assert(false, 'not reachable');
}
}
......
......@@ -1588,7 +1588,7 @@ class _DecorationElement extends RenderObjectElement {
}
@override
void mount(Element? parent, dynamic newSlot) {
void mount(Element? parent, Object? newSlot) {
super.mount(parent, newSlot);
_mountChild(widget.decoration.icon, _DecorationSlot.icon);
_mountChild(widget.decoration.input, _DecorationSlot.input);
......@@ -1685,7 +1685,7 @@ class _DecorationElement extends RenderObjectElement {
}
@override
void moveRenderObjectChild(RenderObject child, dynamic oldSlot, dynamic newSlot) {
void moveRenderObjectChild(RenderObject child, Object? oldSlot, Object? newSlot) {
assert(false, 'not reachable');
}
}
......
......@@ -1327,7 +1327,7 @@ class _ListTileElement extends RenderObjectElement {
}
@override
void mount(Element? parent, dynamic newSlot) {
void mount(Element? parent, Object? newSlot) {
super.mount(parent, newSlot);
_mountChild(widget.leading, _ListTileSlot.leading);
_mountChild(widget.title, _ListTileSlot.title);
......@@ -1389,7 +1389,7 @@ class _ListTileElement extends RenderObjectElement {
}
@override
void moveRenderObjectChild(RenderObject child, dynamic oldSlot, dynamic newSlot) {
void moveRenderObjectChild(RenderObject child, Object? oldSlot, Object? newSlot) {
assert(false, 'not reachable');
}
}
......
......@@ -1153,7 +1153,7 @@ class RenderObjectToWidgetElement<T extends RenderObject> extends RootRenderObje
}
@override
void mount(Element? parent, dynamic newSlot) {
void mount(Element? parent, Object? newSlot) {
assert(parent == null);
super.mount(parent, newSlot);
_rebuild();
......@@ -1204,19 +1204,19 @@ class RenderObjectToWidgetElement<T extends RenderObject> extends RootRenderObje
RenderObjectWithChildMixin<T> get renderObject => super.renderObject as RenderObjectWithChildMixin<T>;
@override
void insertRenderObjectChild(RenderObject child, dynamic slot) {
void insertRenderObjectChild(RenderObject child, Object? slot) {
assert(slot == _rootChildSlot);
assert(renderObject.debugValidateChild(child));
renderObject.child = child as T;
}
@override
void moveRenderObjectChild(RenderObject child, dynamic oldSlot, dynamic newSlot) {
void moveRenderObjectChild(RenderObject child, Object? oldSlot, Object? newSlot) {
assert(false);
}
@override
void removeRenderObjectChild(RenderObject child, dynamic slot) {
void removeRenderObjectChild(RenderObject child, Object? slot) {
assert(renderObject.child == child);
renderObject.child = null;
}
......
......@@ -79,7 +79,7 @@ class _LayoutBuilderElement<ConstraintType extends Constraints> extends RenderOb
}
@override
void mount(Element? parent, dynamic newSlot) {
void mount(Element? parent, Object? newSlot) {
super.mount(parent, newSlot); // Creates the renderObject.
renderObject.updateCallback(_layout);
}
......@@ -152,7 +152,7 @@ class _LayoutBuilderElement<ConstraintType extends Constraints> extends RenderOb
}
@override
void insertRenderObjectChild(RenderObject child, dynamic slot) {
void insertRenderObjectChild(RenderObject child, Object? slot) {
final RenderObjectWithChildMixin<RenderObject> renderObject = this.renderObject;
assert(slot == null);
assert(renderObject.debugValidateChild(child));
......@@ -161,12 +161,12 @@ class _LayoutBuilderElement<ConstraintType extends Constraints> extends RenderOb
}
@override
void moveRenderObjectChild(RenderObject child, dynamic oldSlot, dynamic newSlot) {
void moveRenderObjectChild(RenderObject child, Object? oldSlot, Object? newSlot) {
assert(false);
}
@override
void removeRenderObjectChild(RenderObject child, dynamic slot) {
void removeRenderObjectChild(RenderObject child, Object? slot) {
final RenderConstrainedLayoutBuilder<ConstraintType, RenderObject> renderObject = this.renderObject;
assert(renderObject.child == child);
renderObject.child = null;
......
......@@ -889,12 +889,12 @@ class ListWheelElement extends RenderObjectElement implements ListWheelChildMana
}
@override
Element? updateChild(Element? child, Widget? newWidget, dynamic newSlot) {
Element? updateChild(Element? child, Widget? newWidget, Object? newSlot) {
final ListWheelParentData? oldParentData = child?.renderObject?.parentData as ListWheelParentData?;
final Element? newChild = super.updateChild(child, newWidget, newSlot);
final ListWheelParentData? newParentData = newChild?.renderObject?.parentData as ListWheelParentData?;
if (newParentData != null) {
newParentData.index = newSlot as int;
newParentData.index = newSlot! as int;
if (oldParentData != null)
newParentData.offset = oldParentData.offset;
}
......
......@@ -1236,7 +1236,7 @@ class SliverMultiBoxAdaptorElement extends RenderObjectElement implements Render
}
@override
Element? updateChild(Element? child, Widget? newWidget, dynamic newSlot) {
Element? updateChild(Element? child, Widget? newWidget, Object? newSlot) {
final SliverMultiBoxAdaptorParentData? oldParentData = child?.renderObject?.parentData as SliverMultiBoxAdaptorParentData?;
final Element? newChild = super.updateChild(child, newWidget, newSlot);
final SliverMultiBoxAdaptorParentData? newParentData = newChild?.renderObject?.parentData as SliverMultiBoxAdaptorParentData?;
......
......@@ -195,7 +195,7 @@ class _SliverPersistentHeaderElement extends RenderObjectElement {
_RenderSliverPersistentHeaderForWidgetsMixin get renderObject => super.renderObject as _RenderSliverPersistentHeaderForWidgetsMixin;
@override
void mount(Element? parent, dynamic newSlot) {
void mount(Element? parent, Object? newSlot) {
super.mount(parent, newSlot);
renderObject._element = this;
}
......@@ -247,18 +247,18 @@ class _SliverPersistentHeaderElement extends RenderObjectElement {
}
@override
void insertRenderObjectChild(covariant RenderBox child, dynamic slot) {
void insertRenderObjectChild(covariant RenderBox child, Object? slot) {
assert(renderObject.debugValidateChild(child));
renderObject.child = child;
}
@override
void moveRenderObjectChild(covariant RenderObject child, dynamic oldSlot, dynamic newSlot) {
void moveRenderObjectChild(covariant RenderObject child, Object? oldSlot, Object? newSlot) {
assert(false);
}
@override
void removeRenderObjectChild(covariant RenderObject child, dynamic slot) {
void removeRenderObjectChild(covariant RenderObject child, Object? slot) {
renderObject.child = null;
}
......
......@@ -72,7 +72,7 @@ class _SliverPrototypeExtentListElement extends SliverMultiBoxAdaptorElement {
static final Object _prototypeSlot = Object();
@override
void insertRenderObjectChild(covariant RenderObject child, covariant dynamic slot) {
void insertRenderObjectChild(covariant RenderObject child, covariant Object slot) {
if (slot == _prototypeSlot) {
assert(child is RenderBox);
renderObject.child = child as RenderBox;
......@@ -88,7 +88,7 @@ class _SliverPrototypeExtentListElement extends SliverMultiBoxAdaptorElement {
}
@override
void moveRenderObjectChild(RenderBox child, dynamic oldSlot, dynamic newSlot) {
void moveRenderObjectChild(RenderBox child, Object oldSlot, Object newSlot) {
if (newSlot == _prototypeSlot)
assert(false); // There's only one prototype child so it cannot be moved.
else
......@@ -96,7 +96,7 @@ class _SliverPrototypeExtentListElement extends SliverMultiBoxAdaptorElement {
}
@override
void removeRenderObjectChild(RenderBox child, dynamic slot) {
void removeRenderObjectChild(RenderBox child, Object slot) {
if (renderObject.child == child)
renderObject.child = null;
else
......@@ -111,7 +111,7 @@ class _SliverPrototypeExtentListElement extends SliverMultiBoxAdaptorElement {
}
@override
void mount(Element? parent, dynamic newSlot) {
void mount(Element? parent, Object? newSlot) {
super.mount(parent, newSlot);
_prototype = updateChild(_prototype, widget.prototypeItem, _prototypeSlot);
}
......
......@@ -218,7 +218,7 @@ class _ViewportElement extends MultiChildRenderObjectElement {
RenderViewport get renderObject => super.renderObject as RenderViewport;
@override
void mount(Element? parent, dynamic newSlot) {
void mount(Element? parent, Object? newSlot) {
super.mount(parent, newSlot);
_updateCenter();
}
......
......@@ -104,7 +104,7 @@ abstract class SwapperElement extends RenderObjectElement {
}
@override
void mount(Element? parent, dynamic newSlot) {
void mount(Element? parent, Object? newSlot) {
super.mount(parent, newSlot);
_updateChildren(widget);
}
......@@ -120,13 +120,13 @@ class SwapperElementWithProperOverrides extends SwapperElement {
SwapperElementWithProperOverrides(Swapper widget) : super(widget);
@override
void insertRenderObjectChild(RenderBox child, dynamic slot) {
void insertRenderObjectChild(RenderBox child, Object? slot) {
insertSlots.add(slot);
assert(child != null);
if (slot == 'stable')
renderObject.stable = child;
else
renderObject.setSwapper(child, slot as bool);
renderObject.setSwapper(child, slot! as bool);
}
@override
......@@ -137,12 +137,12 @@ class SwapperElementWithProperOverrides extends SwapperElement {
}
@override
void removeRenderObjectChild(RenderBox child, dynamic slot) {
void removeRenderObjectChild(RenderBox child, Object? slot) {
removeSlots.add(slot);
if (slot == 'stable')
renderObject.stable = null;
else
renderObject.setSwapper(null, slot as bool);
renderObject.setSwapper(null, slot! as bool);
}
}
......@@ -155,13 +155,13 @@ class SwapperElementWithDeprecatedOverrides extends SwapperElement {
@override
// ignore: must_call_super
void insertChildRenderObject(RenderBox child, dynamic slot) {
void insertChildRenderObject(RenderBox child, Object? slot) {
insertSlots.add(slot);
assert(child != null);
if (slot == 'stable')
renderObject.stable = child;
else
renderObject.setSwapper(child, slot as bool);
renderObject.setSwapper(child, slot! as bool);
}
@override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment