operator >>

ReactElement operator >>(

  1. Object? child
)

Adds children using the >> operator.

Supports:

  • String → text child
  • ReactElement → single element child
  • El → unwrapped element child
  • List<Object> → multiple children (can contain strings, elements)
  • null → ignored (supports conditional rendering)

Implementation

ReactElement operator >>(Object? child) => switch (child) {
  null => _element,
  final String s => _withTextChild(s),
  final List<Object?> list => _withChildren(list),
  final num n => _withTextChild(n.toString()),
  final El el => _withSingleChild(el._element),
  final ReactElement re => _withSingleChild(re),
  _ => _element,
};