call method
ReactElement
call([
- dynamic c1 = notSpecified,
- dynamic c2 = notSpecified,
- dynamic c3 = notSpecified,
- dynamic c4 = notSpecified,
- dynamic c5 = notSpecified,
- dynamic c6 = notSpecified,
- dynamic c7 = notSpecified,
- dynamic c8 = notSpecified,
- dynamic c9 = notSpecified,
- dynamic c10 = notSpecified,
- dynamic c11 = notSpecified,
- dynamic c12 = notSpecified,
- dynamic c13 = notSpecified,
- dynamic c14 = notSpecified,
- dynamic c15 = notSpecified,
- dynamic c16 = notSpecified,
- dynamic c17 = notSpecified,
- dynamic c18 = notSpecified,
- dynamic c19 = notSpecified,
- dynamic c20 = notSpecified,
- dynamic c21 = notSpecified,
- dynamic c22 = notSpecified,
- dynamic c23 = notSpecified,
- dynamic c24 = notSpecified,
- dynamic c25 = notSpecified,
- dynamic c26 = notSpecified,
- dynamic c27 = notSpecified,
- dynamic c28 = notSpecified,
- dynamic c29 = notSpecified,
- dynamic c30 = notSpecified,
- dynamic c31 = notSpecified,
- dynamic c32 = notSpecified,
- dynamic c33 = notSpecified,
- dynamic c34 = notSpecified,
- dynamic c35 = notSpecified,
- dynamic c36 = notSpecified,
- dynamic c37 = notSpecified,
- dynamic c38 = notSpecified,
- dynamic c39 = notSpecified,
- dynamic c40 = notSpecified,
Creates a new component with this builder's props and the specified children.
(alias for build with support for variadic children)
This method actually takes any number of children as arguments (c2
, c3
, ...) via noSuchMethod.
Restricted statically to 40 arguments until the dart2js fix in github.com/dart-lang/sdk/pull/26032 is released.
Implementation
ReactElement call([c1 = notSpecified, c2 = notSpecified, c3 = notSpecified, c4 = notSpecified, c5 = notSpecified, c6 = notSpecified, c7 = notSpecified, c8 = notSpecified, c9 = notSpecified, c10 = notSpecified, c11 = notSpecified, c12 = notSpecified, c13 = notSpecified, c14 = notSpecified, c15 = notSpecified, c16 = notSpecified, c17 = notSpecified, c18 = notSpecified, c19 = notSpecified, c20 = notSpecified, c21 = notSpecified, c22 = notSpecified, c23 = notSpecified, c24 = notSpecified, c25 = notSpecified, c26 = notSpecified, c27 = notSpecified, c28 = notSpecified, c29 = notSpecified, c30 = notSpecified, c31 = notSpecified, c32 = notSpecified, c33 = notSpecified, c34 = notSpecified, c35 = notSpecified, c36 = notSpecified, c37 = notSpecified, c38 = notSpecified, c39 = notSpecified, c40 = notSpecified]) {
List childArguments;
// Use `identical` since it compiles down to `===` in dart2js instead of calling equality helper functions,
// and we don't want to allow any object overriding `operator==` to claim it's equal to `_notSpecified`.
if (identical(c1, notSpecified)) {
// Use a const list so that empty children prop values are always identical
// in the JS props, resulting in JS libraries (e.g., react-redux) and Dart code alike
// not marking props as having changed as a result of rerendering the ReactElement with a new list.
childArguments = const [];
} else if (identical(c2, notSpecified)) {
childArguments = [c1];
} else if (identical(c3, notSpecified)) {
childArguments = [c1, c2];
} else if (identical(c4, notSpecified)) {
childArguments = [c1, c2, c3];
} else if (identical(c5, notSpecified)) {
childArguments = [c1, c2, c3, c4];
} else if (identical(c6, notSpecified)) {
childArguments = [c1, c2, c3, c4, c5];
} else if (identical(c7, notSpecified)) {
childArguments = [c1, c2, c3, c4, c5, c6];
} else {
childArguments = [c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40]
.takeWhile((child) => !identical(child, notSpecified))
.toList();
}
// Ideally we'd put this assert into _sharedAsserts, but we want to make sure this conditional child logic
// gets compiled out by directly nesting it within an `assert`.
assert(_validateChildren(childArguments.length == 1 ? childArguments.single : childArguments));
_sharedAsserts();
// Use `build` instead of using emulated function behavior to work around DDC issue
// https://github.com/dart-lang/sdk/issues/29904
// Should have the benefit of better performance;
return componentFactory!.build(props, childArguments);
}