I am new to Flutter and working on build html widget using flutter_html with version flutter_html^3.0.0-beta.2. With the recent version updates I am getting one error for onLinkTap function.
Following is the code:
static Widget getHTMLWidget(String htmlContent, Function onTap) {
return Html(
shrinkWrap: true,
data: htmlContent,
onLinkTap: (
String? url,
RenderContext renderContext,
Map<String, String> attributes, element
) async {
onTapFunction();
},
);
}
Error from IDE is:
The argument type 'void Function(String?, Map<String, String>, Map<String, String>, dynamic)' can't be assigned to the parameter type 'void Function(String?, Map<String, String>, Element?)?'.dartargument_type_not_assignable
As per the latest version code changes we need to call the function like below,
Html(
shrinkWrap: true,
data: htmlContent,
onLinkTap: (url, _, __) {
onTapFunction();
}
);