Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions packages/core/lib/src/data/build_op.dart
Original file line number Diff line number Diff line change
Expand Up @@ -169,17 +169,17 @@ class BuildOp {
(onWidgets != null
? (tree, placeholder) {
final children = onWidgets(tree, [placeholder]);
switch (children?.length) {
case null:
return placeholder;
case 0:
return widget0;
case 1:
return children?.first ?? widget0;
default:
throw UnsupportedError(
'onWidgets must return exactly 1 widget, got ${children?.length}',
);
final length = children?.length;
if (length == null) {
return placeholder;
} else if (length == 0) {
return widget0;
} else if (length == 1) {
return children!.first;
} else {
throw UnsupportedError(
'onWidgets must return exactly 1 widget, got $length',
);
}
}
: null);
Expand Down
8 changes: 7 additions & 1 deletion packages/core/test/_.dart
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,13 @@ Future<String> explainWithoutPumping({
).explain(built);

str = str.replaceAll(RegExp('String#[^,]+,'), 'String,');
return str.replaceAll(RegExp('Uint8List#[0-9a-f]+,'), 'bytes,');
str = str.replaceAll(RegExp('Uint8List#[0-9a-f]+,'), 'bytes,');

// images
str = str.replaceAll(', headers: null', '');
str = str.replaceAll(', webHtmlElementStrategy: never', '');

return str;
}

final _explainMarginRegExp = RegExp(
Expand Down
Loading