@@ -479,8 +479,8 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
479479 }
480480
481481 Future <void > _forceRebuild () {
482- if (renderViewElement != null ) {
483- buildOwner! .reassemble (renderViewElement ! , null );
482+ if (rootElement != null ) {
483+ buildOwner! .reassemble (rootElement ! , null );
484484 return endOfFrame;
485485 }
486486 return Future <void >.value ();
@@ -889,8 +889,8 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
889889 }
890890
891891 try {
892- if (renderViewElement != null ) {
893- buildOwner! .buildScope (renderViewElement ! );
892+ if (rootElement != null ) {
893+ buildOwner! .buildScope (rootElement ! );
894894 }
895895 super .drawFrame ();
896896 buildOwner! .finalizeTree ();
@@ -914,12 +914,20 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
914914 }
915915 }
916916
917- /// The [Element] that is at the root of the hierarchy (and which wraps the
918- /// [RenderView] object at the root of the rendering hierarchy).
917+ /// The [Element] that is at the root of the element tree hierarchy.
919918 ///
920919 /// This is initialized the first time [runApp] is called.
921- Element ? get renderViewElement => _renderViewElement;
922- Element ? _renderViewElement;
920+ Element ? get rootElement => _rootElement;
921+ Element ? _rootElement;
922+
923+ /// Deprecated. Will be removed in a future version of Flutter.
924+ ///
925+ /// Use [rootElement] instead.
926+ @Deprecated (
927+ 'Use rootElement instead. '
928+ 'This feature was deprecated after v3.9.0-16.0.pre.'
929+ )
930+ Element ? get renderViewElement => rootElement;
923931
924932 bool _readyToProduceFrames = false ;
925933
@@ -951,7 +959,7 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
951959 });
952960 }
953961
954- /// Takes a widget and attaches it to the [renderViewElement ] , creating it if
962+ /// Takes a widget and attaches it to the [rootElement ] , creating it if
955963 /// necessary.
956964 ///
957965 /// This is called by [runApp] to configure the widget tree.
@@ -961,23 +969,23 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
961969 /// * [RenderObjectToWidgetAdapter.attachToRenderTree] , which inflates a
962970 /// widget and attaches it to the render tree.
963971 void attachRootWidget (Widget rootWidget) {
964- final bool isBootstrapFrame = renderViewElement == null ;
972+ final bool isBootstrapFrame = rootElement == null ;
965973 _readyToProduceFrames = true ;
966- _renderViewElement = RenderObjectToWidgetAdapter <RenderBox >(
974+ _rootElement = RenderObjectToWidgetAdapter <RenderBox >(
967975 container: renderView,
968976 debugShortDescription: '[root]' ,
969977 child: rootWidget,
970- ).attachToRenderTree (buildOwner! , renderViewElement as RenderObjectToWidgetElement <RenderBox >? );
978+ ).attachToRenderTree (buildOwner! , rootElement as RenderObjectToWidgetElement <RenderBox >? );
971979 if (isBootstrapFrame) {
972980 SchedulerBinding .instance.ensureVisualUpdate ();
973981 }
974982 }
975983
976- /// Whether the [renderViewElement ] has been initialized.
984+ /// Whether the [rootElement ] has been initialized.
977985 ///
978986 /// This will be false until [runApp] is called (or [WidgetTester.pumpWidget]
979987 /// is called in the context of a [TestWidgetsFlutterBinding] ).
980- bool get isRootWidgetAttached => _renderViewElement != null ;
988+ bool get isRootWidgetAttached => _rootElement != null ;
981989
982990 @override
983991 Future <void > performReassemble () {
@@ -986,8 +994,8 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
986994 return true ;
987995 }());
988996
989- if (renderViewElement != null ) {
990- buildOwner! .reassemble (renderViewElement ! , BindingBase .debugReassembleConfig);
997+ if (rootElement != null ) {
998+ buildOwner! .reassemble (rootElement ! , BindingBase .debugReassembleConfig);
991999 }
9921000 return super .performReassemble ();
9931001 }
@@ -1069,8 +1077,8 @@ String _debugDumpAppString() {
10691077 const String mode = kDebugMode ? 'DEBUG MODE' : kReleaseMode ? 'RELEASE MODE' : 'PROFILE MODE' ;
10701078 final StringBuffer buffer = StringBuffer ();
10711079 buffer.writeln ('${WidgetsBinding .instance .runtimeType } - $mode ' );
1072- if (WidgetsBinding .instance.renderViewElement != null ) {
1073- buffer.writeln (WidgetsBinding .instance.renderViewElement ! .toStringDeep ());
1080+ if (WidgetsBinding .instance.rootElement != null ) {
1081+ buffer.writeln (WidgetsBinding .instance.rootElement ! .toStringDeep ());
10741082 } else {
10751083 buffer.writeln ('<no tree currently mounted>' );
10761084 }
@@ -1148,7 +1156,7 @@ class RenderObjectToWidgetAdapter<T extends RenderObject> extends RenderObjectWi
11481156 String toStringShort () => debugShortDescription ?? super .toStringShort ();
11491157}
11501158
1151- /// A [RootRenderObjectElement] that is hosted by a [RenderObject] .
1159+ /// The root of the element tree that is hosted by a [RenderObject] .
11521160///
11531161/// This element class is the instantiation of a [RenderObjectToWidgetAdapter]
11541162/// widget. It can be used only as the root of an [Element] tree (it cannot be
@@ -1158,7 +1166,7 @@ class RenderObjectToWidgetAdapter<T extends RenderObject> extends RenderObjectWi
11581166/// whose container is the [RenderView] that connects to the Flutter engine. In
11591167/// this usage, it is normally instantiated by the bootstrapping logic in the
11601168/// [WidgetsFlutterBinding] singleton created by [runApp] .
1161- class RenderObjectToWidgetElement <T extends RenderObject > extends RootRenderObjectElement {
1169+ class RenderObjectToWidgetElement <T extends RenderObject > extends RenderObjectElement with RootElementMixin {
11621170 /// Creates an element that is hosted by a [RenderObject] .
11631171 ///
11641172 /// The [RenderObject] created by this element is not automatically set as a
0 commit comments