New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parser crashes on entry-hyperlinks #8
Comments
Yup, I would guess that null-checking the https://github.com/Kumanu/contentful-rich-text-flutter/blob/master/lib/contentful_rich_text.dart
Happy to accept a PR that updates that, or I'll try to address it. In the meantime I'd recommend not including the entry link if possible. |
Disabling unsupported types is definitely planned, however I would still prefer if the parser wouldn't crash in case the configuration is off ;) I'll create a PR with this check: if (textNode.value == null) return TextSpan(); Would it be ok to also add the following block? That way links to entries would still be ignored, but at least the text would be output. Without it, the above would only output a blank line: // for links to entries only process the child-nodes
if (node['nodeType'] == 'entry-hyperlink') {
return TextSpan(
children: node['content']
.map<TextSpan>((subNode) => _processInlineNode(subNode) as TextSpan)
.toList(),
);
} |
Yup, I like the idea of keeping the text 👍 |
resolved via #9 |
The readme says inline hyperlinks to entries are not supported (entry-hyperlinks/ENTRY_HYPERLINK), however the parser even crashes when it encounters these. Is it possible to have the parser just ignore these as it does with embedded assets for example?
Below is an example JSON generated by Contentful, my Dart file to parse the JSON (it contains the same JSON just encoded), and the log of the crash.
The text was updated successfully, but these errors were encountered: