@@ -62,7 +62,7 @@ class HtmlParser extends StatelessWidget {
62
62
required this .imageRenders,
63
63
required this .blacklistedElements,
64
64
required this .navigationDelegateForIframe,
65
- }): this ._onAnchorTap = key != null && onLinkTap != null ? _handleAnchorTap (key, onLinkTap): null , super (key: key);
65
+ }): this ._onAnchorTap = key != null ? _handleAnchorTap (key, onLinkTap): null , super (key: key);
66
66
67
67
@override
68
68
Widget build (BuildContext context) {
@@ -442,7 +442,7 @@ class HtmlParser extends StatelessWidget {
442
442
}
443
443
}
444
444
445
- static OnTap _handleAnchorTap (Key key, OnTap onLinkTap) =>
445
+ static OnTap _handleAnchorTap (Key key, OnTap ? onLinkTap) =>
446
446
(String ? url, RenderContext context, Map <String , String > attributes, dom.Element ? element) {
447
447
if (url? .startsWith ("#" ) == true ) {
448
448
final anchorContext = AnchorKey .forId (key, url! .substring (1 ))? .currentContext;
@@ -451,7 +451,7 @@ class HtmlParser extends StatelessWidget {
451
451
}
452
452
return ;
453
453
}
454
- onLinkTap.call (url, context, attributes, element);
454
+ onLinkTap? .call (url, context, attributes, element);
455
455
};
456
456
457
457
/// [processWhitespace] removes unnecessary whitespace from the StyledElement tree.
0 commit comments