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. Please help me on resolving this. Following is the code and error message i am getting.
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
2
Answers
As per the latest version code changes we need to call the function like below,
This version isn’t ready for production. It’s probably that the documentation isn’t ready yet.
The latest release version of this package is
flutter_html: ^2.2.1
according to the docs ondart.pub
as you can check hereAnd if this worked before, maybe the arguments of this method were changed and we couldn’t know without the docs. If you really need to test this beta version, try to open an Issue on their Github Repository.