File tree Expand file tree Collapse file tree
packages/flame/lib/src/components/core Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -598,8 +598,8 @@ class Component {
598598 /// cleans them up afterwards.
599599 @protected
600600 void renderChild (Canvas canvas, Component child) {
601- final contexts = _renderContexts;
602- if (contexts == null || contexts .isEmpty) {
601+ final contexts = _renderContexts ?? const < ComponentRenderContext > [] ;
602+ if (contexts.isEmpty) {
603603 child.renderTree (canvas);
604604 return ;
605605 }
@@ -619,8 +619,10 @@ class Component {
619619
620620 void renderTree (Canvas canvas) {
621621 final context = renderContext;
622+ List <ComponentRenderContext >? renderContexts;
622623 if (context != null ) {
623- (_renderContexts ?? = []).add (context);
624+ renderContexts = _renderContexts ?? = [];
625+ renderContexts.add (context);
624626 }
625627
626628 render (canvas);
@@ -637,9 +639,7 @@ class Component {
637639 renderDebugMode (canvas);
638640 }
639641
640- if (context != null ) {
641- _renderContexts! .removeLast ();
642- }
642+ renderContexts? .removeLast ();
643643 }
644644
645645 //#endregion
You can’t perform that action at this time.
0 commit comments