File tree Expand file tree Collapse file tree 1 file changed +11
-11
lines changed
packages/core/lib/src/data Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -169,17 +169,17 @@ class BuildOp {
169169 (onWidgets != null
170170 ? (tree, placeholder) {
171171 final children = onWidgets (tree, [placeholder]);
172- switch ( children? .length) {
173- case null :
174- return placeholder;
175- case 0 :
176- return widget0;
177- case 1 :
178- return children? .first ?? widget0 ;
179- default :
180- throw UnsupportedError (
181- 'onWidgets must return exactly 1 widget, got ${ children ?. length } ' ,
182- );
172+ final length = children? .length;
173+ if (length == null ) {
174+ return placeholder;
175+ } else if (length == 0 ) {
176+ return widget0;
177+ } else if (length == 1 ) {
178+ return children! .first;
179+ } else {
180+ throw UnsupportedError (
181+ 'onWidgets must return exactly 1 widget, got $length ' ,
182+ );
183183 }
184184 }
185185 : null );
You can’t perform that action at this time.
0 commit comments