BloomIsland constructor

BloomIsland({
  1. required String name,
  2. BloomNode? child,
  3. List<BloomNode>? children,
  4. HydrationStrategy strategy = HydrationStrategy.immediate,
  5. Map<String, dynamic>? props,
  6. String? rootMargin,
  7. String? media,
  8. String tag = 'div',
  9. String? className,
  10. String? style,
  11. Map<String, String>? attrs,
})

Creates a server-side island placeholder descriptor.

Implementation

BloomIsland({
  required String name,
  BloomNode? child,
  List<BloomNode>? children,
  HydrationStrategy strategy = HydrationStrategy.immediate,
  Map<String, dynamic>? props,
  String? rootMargin,
  String? media,
  String tag = 'div',
  String? className,
  String? style,
  Map<String, String>? attrs,
}) : super(
        tag,
        className: className,
        style: style,
        attrs: {
          if (attrs != null) ...attrs,
          bloomIslandAttribute: name,
          if (strategy != HydrationStrategy.immediate)
            bloomStrategyAttribute: strategy.value,
          if (props != null && props.isNotEmpty)
            bloomPropsAttribute: jsonEncode(props),
          if (rootMargin != null)
            bloomRootMarginAttribute: rootMargin,
          if (media != null)
            bloomMediaAttribute: media,
        },
        children: [
          if (child != null) child,
          if (children != null) ...children,
        ],
      );