Use Object? instead of dynamic for Element slots (#78928)
This commit is contained in:
parent
975fb0f06c
commit
2edb685b23
@ -489,7 +489,7 @@ class _CupertinoAlertRenderElement extends RenderObjectElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void mount(Element? parent, dynamic newSlot) {
|
void mount(Element? parent, Object? newSlot) {
|
||||||
super.mount(parent, newSlot);
|
super.mount(parent, newSlot);
|
||||||
_contentElement = updateChild(_contentElement,
|
_contentElement = updateChild(_contentElement,
|
||||||
widget.contentSection, _AlertSections.contentSection);
|
widget.contentSection, _AlertSections.contentSection);
|
||||||
|
@ -389,7 +389,7 @@ class _CupertinoDialogRenderElement extends RenderObjectElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void mount(Element? parent, dynamic newSlot) {
|
void mount(Element? parent, Object? newSlot) {
|
||||||
super.mount(parent, newSlot);
|
super.mount(parent, newSlot);
|
||||||
_contentElement = updateChild(_contentElement, widget.contentSection, _AlertDialogSections.contentSection);
|
_contentElement = updateChild(_contentElement, widget.contentSection, _AlertDialogSections.contentSection);
|
||||||
_actionsElement = updateChild(_actionsElement, widget.actionsSection, _AlertDialogSections.actionsSection);
|
_actionsElement = updateChild(_actionsElement, widget.actionsSection, _AlertDialogSections.actionsSection);
|
||||||
|
@ -535,7 +535,7 @@ class _CupertinoTextSelectionToolbarItemsElement extends RenderObjectElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void insertRenderObjectChild(RenderObject child, dynamic slot) {
|
void insertRenderObjectChild(RenderObject child, Object? slot) {
|
||||||
if (slot is _CupertinoTextSelectionToolbarItemsSlot) {
|
if (slot is _CupertinoTextSelectionToolbarItemsSlot) {
|
||||||
assert(child is RenderBox);
|
assert(child is RenderBox);
|
||||||
_updateRenderObject(child as RenderBox, slot);
|
_updateRenderObject(child as RenderBox, slot);
|
||||||
@ -562,7 +562,7 @@ class _CupertinoTextSelectionToolbarItemsElement extends RenderObjectElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void removeRenderObjectChild(RenderObject child, dynamic slot) {
|
void removeRenderObjectChild(RenderObject child, Object? slot) {
|
||||||
// Check if the child is in a slot.
|
// Check if the child is in a slot.
|
||||||
if (slot is _CupertinoTextSelectionToolbarItemsSlot) {
|
if (slot is _CupertinoTextSelectionToolbarItemsSlot) {
|
||||||
assert(child is RenderBox);
|
assert(child is RenderBox);
|
||||||
@ -614,7 +614,7 @@ class _CupertinoTextSelectionToolbarItemsElement extends RenderObjectElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void mount(Element? parent, dynamic newSlot) {
|
void mount(Element? parent, Object? newSlot) {
|
||||||
super.mount(parent, newSlot);
|
super.mount(parent, newSlot);
|
||||||
// Mount slotted children.
|
// Mount slotted children.
|
||||||
_mountChild(widget.backButton, _CupertinoTextSelectionToolbarItemsSlot.backButton);
|
_mountChild(widget.backButton, _CupertinoTextSelectionToolbarItemsSlot.backButton);
|
||||||
|
@ -2189,7 +2189,7 @@ class _RenderChipElement extends RenderObjectElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void mount(Element? parent, dynamic newSlot) {
|
void mount(Element? parent, Object? newSlot) {
|
||||||
super.mount(parent, newSlot);
|
super.mount(parent, newSlot);
|
||||||
_mountChild(widget.theme.avatar, _ChipSlot.avatar);
|
_mountChild(widget.theme.avatar, _ChipSlot.avatar);
|
||||||
_mountChild(widget.theme.deleteIcon, _ChipSlot.deleteIcon);
|
_mountChild(widget.theme.deleteIcon, _ChipSlot.deleteIcon);
|
||||||
@ -2246,7 +2246,7 @@ class _RenderChipElement extends RenderObjectElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void moveRenderObjectChild(RenderObject child, dynamic oldSlot, dynamic newSlot) {
|
void moveRenderObjectChild(RenderObject child, Object? oldSlot, Object? newSlot) {
|
||||||
assert(false, 'not reachable');
|
assert(false, 'not reachable');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1588,7 +1588,7 @@ class _DecorationElement extends RenderObjectElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void mount(Element? parent, dynamic newSlot) {
|
void mount(Element? parent, Object? newSlot) {
|
||||||
super.mount(parent, newSlot);
|
super.mount(parent, newSlot);
|
||||||
_mountChild(widget.decoration.icon, _DecorationSlot.icon);
|
_mountChild(widget.decoration.icon, _DecorationSlot.icon);
|
||||||
_mountChild(widget.decoration.input, _DecorationSlot.input);
|
_mountChild(widget.decoration.input, _DecorationSlot.input);
|
||||||
@ -1685,7 +1685,7 @@ class _DecorationElement extends RenderObjectElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void moveRenderObjectChild(RenderObject child, dynamic oldSlot, dynamic newSlot) {
|
void moveRenderObjectChild(RenderObject child, Object? oldSlot, Object? newSlot) {
|
||||||
assert(false, 'not reachable');
|
assert(false, 'not reachable');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1327,7 +1327,7 @@ class _ListTileElement extends RenderObjectElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void mount(Element? parent, dynamic newSlot) {
|
void mount(Element? parent, Object? newSlot) {
|
||||||
super.mount(parent, newSlot);
|
super.mount(parent, newSlot);
|
||||||
_mountChild(widget.leading, _ListTileSlot.leading);
|
_mountChild(widget.leading, _ListTileSlot.leading);
|
||||||
_mountChild(widget.title, _ListTileSlot.title);
|
_mountChild(widget.title, _ListTileSlot.title);
|
||||||
@ -1389,7 +1389,7 @@ class _ListTileElement extends RenderObjectElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void moveRenderObjectChild(RenderObject child, dynamic oldSlot, dynamic newSlot) {
|
void moveRenderObjectChild(RenderObject child, Object? oldSlot, Object? newSlot) {
|
||||||
assert(false, 'not reachable');
|
assert(false, 'not reachable');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1153,7 +1153,7 @@ class RenderObjectToWidgetElement<T extends RenderObject> extends RootRenderObje
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void mount(Element? parent, dynamic newSlot) {
|
void mount(Element? parent, Object? newSlot) {
|
||||||
assert(parent == null);
|
assert(parent == null);
|
||||||
super.mount(parent, newSlot);
|
super.mount(parent, newSlot);
|
||||||
_rebuild();
|
_rebuild();
|
||||||
@ -1204,19 +1204,19 @@ class RenderObjectToWidgetElement<T extends RenderObject> extends RootRenderObje
|
|||||||
RenderObjectWithChildMixin<T> get renderObject => super.renderObject as RenderObjectWithChildMixin<T>;
|
RenderObjectWithChildMixin<T> get renderObject => super.renderObject as RenderObjectWithChildMixin<T>;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void insertRenderObjectChild(RenderObject child, dynamic slot) {
|
void insertRenderObjectChild(RenderObject child, Object? slot) {
|
||||||
assert(slot == _rootChildSlot);
|
assert(slot == _rootChildSlot);
|
||||||
assert(renderObject.debugValidateChild(child));
|
assert(renderObject.debugValidateChild(child));
|
||||||
renderObject.child = child as T;
|
renderObject.child = child as T;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void moveRenderObjectChild(RenderObject child, dynamic oldSlot, dynamic newSlot) {
|
void moveRenderObjectChild(RenderObject child, Object? oldSlot, Object? newSlot) {
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void removeRenderObjectChild(RenderObject child, dynamic slot) {
|
void removeRenderObjectChild(RenderObject child, Object? slot) {
|
||||||
assert(renderObject.child == child);
|
assert(renderObject.child == child);
|
||||||
renderObject.child = null;
|
renderObject.child = null;
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ class _LayoutBuilderElement<ConstraintType extends Constraints> extends RenderOb
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void mount(Element? parent, dynamic newSlot) {
|
void mount(Element? parent, Object? newSlot) {
|
||||||
super.mount(parent, newSlot); // Creates the renderObject.
|
super.mount(parent, newSlot); // Creates the renderObject.
|
||||||
renderObject.updateCallback(_layout);
|
renderObject.updateCallback(_layout);
|
||||||
}
|
}
|
||||||
@ -152,7 +152,7 @@ class _LayoutBuilderElement<ConstraintType extends Constraints> extends RenderOb
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void insertRenderObjectChild(RenderObject child, dynamic slot) {
|
void insertRenderObjectChild(RenderObject child, Object? slot) {
|
||||||
final RenderObjectWithChildMixin<RenderObject> renderObject = this.renderObject;
|
final RenderObjectWithChildMixin<RenderObject> renderObject = this.renderObject;
|
||||||
assert(slot == null);
|
assert(slot == null);
|
||||||
assert(renderObject.debugValidateChild(child));
|
assert(renderObject.debugValidateChild(child));
|
||||||
@ -161,12 +161,12 @@ class _LayoutBuilderElement<ConstraintType extends Constraints> extends RenderOb
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void moveRenderObjectChild(RenderObject child, dynamic oldSlot, dynamic newSlot) {
|
void moveRenderObjectChild(RenderObject child, Object? oldSlot, Object? newSlot) {
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void removeRenderObjectChild(RenderObject child, dynamic slot) {
|
void removeRenderObjectChild(RenderObject child, Object? slot) {
|
||||||
final RenderConstrainedLayoutBuilder<ConstraintType, RenderObject> renderObject = this.renderObject;
|
final RenderConstrainedLayoutBuilder<ConstraintType, RenderObject> renderObject = this.renderObject;
|
||||||
assert(renderObject.child == child);
|
assert(renderObject.child == child);
|
||||||
renderObject.child = null;
|
renderObject.child = null;
|
||||||
|
@ -889,12 +889,12 @@ class ListWheelElement extends RenderObjectElement implements ListWheelChildMana
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@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 ListWheelParentData? oldParentData = child?.renderObject?.parentData as ListWheelParentData?;
|
||||||
final Element? newChild = super.updateChild(child, newWidget, newSlot);
|
final Element? newChild = super.updateChild(child, newWidget, newSlot);
|
||||||
final ListWheelParentData? newParentData = newChild?.renderObject?.parentData as ListWheelParentData?;
|
final ListWheelParentData? newParentData = newChild?.renderObject?.parentData as ListWheelParentData?;
|
||||||
if (newParentData != null) {
|
if (newParentData != null) {
|
||||||
newParentData.index = newSlot as int;
|
newParentData.index = newSlot! as int;
|
||||||
if (oldParentData != null)
|
if (oldParentData != null)
|
||||||
newParentData.offset = oldParentData.offset;
|
newParentData.offset = oldParentData.offset;
|
||||||
}
|
}
|
||||||
|
@ -1236,7 +1236,7 @@ class SliverMultiBoxAdaptorElement extends RenderObjectElement implements Render
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@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 SliverMultiBoxAdaptorParentData? oldParentData = child?.renderObject?.parentData as SliverMultiBoxAdaptorParentData?;
|
||||||
final Element? newChild = super.updateChild(child, newWidget, newSlot);
|
final Element? newChild = super.updateChild(child, newWidget, newSlot);
|
||||||
final SliverMultiBoxAdaptorParentData? newParentData = newChild?.renderObject?.parentData as SliverMultiBoxAdaptorParentData?;
|
final SliverMultiBoxAdaptorParentData? newParentData = newChild?.renderObject?.parentData as SliverMultiBoxAdaptorParentData?;
|
||||||
|
@ -195,7 +195,7 @@ class _SliverPersistentHeaderElement extends RenderObjectElement {
|
|||||||
_RenderSliverPersistentHeaderForWidgetsMixin get renderObject => super.renderObject as _RenderSliverPersistentHeaderForWidgetsMixin;
|
_RenderSliverPersistentHeaderForWidgetsMixin get renderObject => super.renderObject as _RenderSliverPersistentHeaderForWidgetsMixin;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void mount(Element? parent, dynamic newSlot) {
|
void mount(Element? parent, Object? newSlot) {
|
||||||
super.mount(parent, newSlot);
|
super.mount(parent, newSlot);
|
||||||
renderObject._element = this;
|
renderObject._element = this;
|
||||||
}
|
}
|
||||||
@ -247,18 +247,18 @@ class _SliverPersistentHeaderElement extends RenderObjectElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void insertRenderObjectChild(covariant RenderBox child, dynamic slot) {
|
void insertRenderObjectChild(covariant RenderBox child, Object? slot) {
|
||||||
assert(renderObject.debugValidateChild(child));
|
assert(renderObject.debugValidateChild(child));
|
||||||
renderObject.child = child;
|
renderObject.child = child;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void moveRenderObjectChild(covariant RenderObject child, dynamic oldSlot, dynamic newSlot) {
|
void moveRenderObjectChild(covariant RenderObject child, Object? oldSlot, Object? newSlot) {
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void removeRenderObjectChild(covariant RenderObject child, dynamic slot) {
|
void removeRenderObjectChild(covariant RenderObject child, Object? slot) {
|
||||||
renderObject.child = null;
|
renderObject.child = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ class _SliverPrototypeExtentListElement extends SliverMultiBoxAdaptorElement {
|
|||||||
static final Object _prototypeSlot = Object();
|
static final Object _prototypeSlot = Object();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void insertRenderObjectChild(covariant RenderObject child, covariant dynamic slot) {
|
void insertRenderObjectChild(covariant RenderObject child, covariant Object slot) {
|
||||||
if (slot == _prototypeSlot) {
|
if (slot == _prototypeSlot) {
|
||||||
assert(child is RenderBox);
|
assert(child is RenderBox);
|
||||||
renderObject.child = child as RenderBox;
|
renderObject.child = child as RenderBox;
|
||||||
@ -88,7 +88,7 @@ class _SliverPrototypeExtentListElement extends SliverMultiBoxAdaptorElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void moveRenderObjectChild(RenderBox child, dynamic oldSlot, dynamic newSlot) {
|
void moveRenderObjectChild(RenderBox child, Object oldSlot, Object newSlot) {
|
||||||
if (newSlot == _prototypeSlot)
|
if (newSlot == _prototypeSlot)
|
||||||
assert(false); // There's only one prototype child so it cannot be moved.
|
assert(false); // There's only one prototype child so it cannot be moved.
|
||||||
else
|
else
|
||||||
@ -96,7 +96,7 @@ class _SliverPrototypeExtentListElement extends SliverMultiBoxAdaptorElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void removeRenderObjectChild(RenderBox child, dynamic slot) {
|
void removeRenderObjectChild(RenderBox child, Object slot) {
|
||||||
if (renderObject.child == child)
|
if (renderObject.child == child)
|
||||||
renderObject.child = null;
|
renderObject.child = null;
|
||||||
else
|
else
|
||||||
@ -111,7 +111,7 @@ class _SliverPrototypeExtentListElement extends SliverMultiBoxAdaptorElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void mount(Element? parent, dynamic newSlot) {
|
void mount(Element? parent, Object? newSlot) {
|
||||||
super.mount(parent, newSlot);
|
super.mount(parent, newSlot);
|
||||||
_prototype = updateChild(_prototype, widget.prototypeItem, _prototypeSlot);
|
_prototype = updateChild(_prototype, widget.prototypeItem, _prototypeSlot);
|
||||||
}
|
}
|
||||||
|
@ -218,7 +218,7 @@ class _ViewportElement extends MultiChildRenderObjectElement {
|
|||||||
RenderViewport get renderObject => super.renderObject as RenderViewport;
|
RenderViewport get renderObject => super.renderObject as RenderViewport;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void mount(Element? parent, dynamic newSlot) {
|
void mount(Element? parent, Object? newSlot) {
|
||||||
super.mount(parent, newSlot);
|
super.mount(parent, newSlot);
|
||||||
_updateCenter();
|
_updateCenter();
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ abstract class SwapperElement extends RenderObjectElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void mount(Element? parent, dynamic newSlot) {
|
void mount(Element? parent, Object? newSlot) {
|
||||||
super.mount(parent, newSlot);
|
super.mount(parent, newSlot);
|
||||||
_updateChildren(widget);
|
_updateChildren(widget);
|
||||||
}
|
}
|
||||||
@ -120,13 +120,13 @@ class SwapperElementWithProperOverrides extends SwapperElement {
|
|||||||
SwapperElementWithProperOverrides(Swapper widget) : super(widget);
|
SwapperElementWithProperOverrides(Swapper widget) : super(widget);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void insertRenderObjectChild(RenderBox child, dynamic slot) {
|
void insertRenderObjectChild(RenderBox child, Object? slot) {
|
||||||
insertSlots.add(slot);
|
insertSlots.add(slot);
|
||||||
assert(child != null);
|
assert(child != null);
|
||||||
if (slot == 'stable')
|
if (slot == 'stable')
|
||||||
renderObject.stable = child;
|
renderObject.stable = child;
|
||||||
else
|
else
|
||||||
renderObject.setSwapper(child, slot as bool);
|
renderObject.setSwapper(child, slot! as bool);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -137,12 +137,12 @@ class SwapperElementWithProperOverrides extends SwapperElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void removeRenderObjectChild(RenderBox child, dynamic slot) {
|
void removeRenderObjectChild(RenderBox child, Object? slot) {
|
||||||
removeSlots.add(slot);
|
removeSlots.add(slot);
|
||||||
if (slot == 'stable')
|
if (slot == 'stable')
|
||||||
renderObject.stable = null;
|
renderObject.stable = null;
|
||||||
else
|
else
|
||||||
renderObject.setSwapper(null, slot as bool);
|
renderObject.setSwapper(null, slot! as bool);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,13 +155,13 @@ class SwapperElementWithDeprecatedOverrides extends SwapperElement {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
// ignore: must_call_super
|
// ignore: must_call_super
|
||||||
void insertChildRenderObject(RenderBox child, dynamic slot) {
|
void insertChildRenderObject(RenderBox child, Object? slot) {
|
||||||
insertSlots.add(slot);
|
insertSlots.add(slot);
|
||||||
assert(child != null);
|
assert(child != null);
|
||||||
if (slot == 'stable')
|
if (slot == 'stable')
|
||||||
renderObject.stable = child;
|
renderObject.stable = child;
|
||||||
else
|
else
|
||||||
renderObject.setSwapper(child, slot as bool);
|
renderObject.setSwapper(child, slot! as bool);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user