Get rid of _NullElement. (#146741)
Fixes https://github.com/flutter/flutter/issues/145602
This commit is contained in:
committed by
GitHub
parent
9ac724d71b
commit
ae0a0dfc6b
@@ -887,13 +887,12 @@ class _CupertinoTextSelectionToolbarItemsElement extends RenderObjectElement {
|
||||
_mountChild(toolbarItems.nextButton, _CupertinoTextSelectionToolbarItemsSlot.nextButton);
|
||||
|
||||
// Mount list children.
|
||||
_children = List<Element>.filled(toolbarItems.children.length, _NullElement.instance);
|
||||
Element? previousChild;
|
||||
for (int i = 0; i < _children.length; i += 1) {
|
||||
final Element newChild = inflateWidget(toolbarItems.children[i], IndexedSlot<Element?>(i, previousChild));
|
||||
_children[i] = newChild;
|
||||
previousChild = newChild;
|
||||
}
|
||||
_children = List<Element>.generate(toolbarItems.children.length, (int i) {
|
||||
final Element result = inflateWidget(toolbarItems.children[i], IndexedSlot<Element?>(i, previousChild));
|
||||
previousChild = result;
|
||||
return result;
|
||||
}, growable: false);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -1273,19 +1272,3 @@ enum _CupertinoTextSelectionToolbarItemsSlot {
|
||||
backButton,
|
||||
nextButton,
|
||||
}
|
||||
|
||||
class _NullElement extends Element {
|
||||
_NullElement() : super(const _NullWidget());
|
||||
|
||||
static _NullElement instance = _NullElement();
|
||||
|
||||
@override
|
||||
bool get debugDoingBuild => throw UnimplementedError();
|
||||
}
|
||||
|
||||
class _NullWidget extends Widget {
|
||||
const _NullWidget();
|
||||
|
||||
@override
|
||||
Element createElement() => throw UnimplementedError();
|
||||
}
|
||||
|
||||
@@ -52,8 +52,6 @@ Future<void> testExecutable(FutureOr<void> Function() testMain) {
|
||||
classes: <String>[
|
||||
// TODO(polina-c): CurvedAnimation is leaking, https://github.com/flutter/flutter/issues/145600 [leaks-to-clean]
|
||||
'CurvedAnimation',
|
||||
// TODO(polina-c): _NullElement is leaking, https://github.com/flutter/flutter/issues/145602 [leaks-to-clean]
|
||||
'_NullElement',
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user