Unverified Commit 24d434d1 authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Revert "Revert "Fix _LateInitializationError for...

Revert "Revert "Fix _LateInitializationError for RenderObjectElement.renderObject (#70974)" (#73575)" (#73580)
parent 5b503c7c
...@@ -5463,8 +5463,8 @@ abstract class RenderObjectElement extends Element { ...@@ -5463,8 +5463,8 @@ abstract class RenderObjectElement extends Element {
/// The underlying [RenderObject] for this element. /// The underlying [RenderObject] for this element.
@override @override
RenderObject get renderObject => _renderObject; RenderObject get renderObject => _renderObject!;
late RenderObject _renderObject; RenderObject? _renderObject;
bool _debugDoingBuild = false; bool _debugDoingBuild = false;
@override @override
...@@ -5566,7 +5566,7 @@ abstract class RenderObjectElement extends Element { ...@@ -5566,7 +5566,7 @@ abstract class RenderObjectElement extends Element {
void _debugUpdateRenderObjectOwner() { void _debugUpdateRenderObjectOwner() {
assert(() { assert(() {
_renderObject.debugCreator = DebugCreator(this); renderObject.debugCreator = DebugCreator(this);
return true; return true;
}()); }());
} }
...@@ -6058,7 +6058,7 @@ abstract class RenderObjectElement extends Element { ...@@ -6058,7 +6058,7 @@ abstract class RenderObjectElement extends Element {
@override @override
void debugFillProperties(DiagnosticPropertiesBuilder properties) { void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties); super.debugFillProperties(properties);
properties.add(DiagnosticsProperty<RenderObject>('renderObject', renderObject, defaultValue: null)); properties.add(DiagnosticsProperty<RenderObject>('renderObject', _renderObject, defaultValue: null));
} }
} }
......
...@@ -1494,6 +1494,12 @@ void main() { ...@@ -1494,6 +1494,12 @@ void main() {
expect(GestureBinding.instance!.pointerRouter.debugGlobalRouteCount, pointerRouterCount); expect(GestureBinding.instance!.pointerRouter.debugGlobalRouteCount, pointerRouterCount);
expect(RawKeyboard.instance.keyEventHandler, same(rawKeyEventHandler)); expect(RawKeyboard.instance.keyEventHandler, same(rawKeyEventHandler));
}); });
testWidgets('Can access debugFillProperties without _LateInitializationError', (WidgetTester tester) async {
final DiagnosticPropertiesBuilder builder = DiagnosticPropertiesBuilder();
TestRenderObjectElement().debugFillProperties(builder);
expect(builder.properties.any((DiagnosticsNode property) => property.name == 'renderObject' && property.value == null), isTrue);
});
} }
class _FakeFocusManager implements FocusManager { class _FakeFocusManager implements FocusManager {
...@@ -1837,3 +1843,7 @@ class FakeLeafRenderObject extends RenderBox { ...@@ -1837,3 +1843,7 @@ class FakeLeafRenderObject extends RenderBox {
size = constraints.biggest; size = constraints.biggest;
} }
} }
class TestRenderObjectElement extends RenderObjectElement {
TestRenderObjectElement() : super(Table());
}
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