Link constructor

Link({
  1. required String href,
  2. PrefetchMode prefetch = PrefetchMode.off,
  3. String? text,
  4. String? className,
  5. String? style,
  6. Map<String, String>? attrs,
  7. List<BloomNode> children = const [],
  8. Map<String, BloomEventHandler>? on,
  9. BloomEventHandler? onClick,
})

Creates a hyperlink element targeting href with optional prefetch behavior.

Implementation

Link({
  required String href,
  this.prefetch = PrefetchMode.off,
  super.text,
  super.className,
  super.style,
  Map<String, String>? attrs,
  super.children = const [],
  Map<String, BloomEventHandler>? on,
  BloomEventHandler? onClick,
}) : super(
        'a',
        attrs: {
          'href': href,
          if (prefetch == PrefetchMode.visible)
            'data-bloom-prefetch': 'visible',
          if (attrs != null) ...attrs,
        },
        on: _buildHandlers(
          href: href,
          prefetch: prefetch,
          on: on,
          onClick: onClick,
        ),
      );