I'm developing a mobile application in flutter. It needs to highlight some urls present in a string based on some logic. I find highlight_text package to do the task. This takes text and words that is to be highlighted. Everything is working fine except when i'm passing text that contains url followed by some number. It is throwing error as following:
Another exception was thrown: RangeError (index): Invalid value: Only valid value is 0: 6777text : In a meeting, will call you later. On my wa'y Please call me later www.something.in 6777
word : www.something.in
But when url is followed by some number and then by some text, it does not throw exception and works well.
text : In a meeting, will call you later. On my way Please call me later www.something.in 6777 test text
This is where i am passing text and words. Exception is throwing at line with keyword TextHighlight. There are text of
exception
══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════ The following RangeError was thrown building TextHighlight(dirty): RangeError (index): Invalid value: Only valid value is 0: 6777
Can someone please tell me what's the issue with my code? I have exhausted debugging it. It’ll be great help.
I'm developing a mobile application in flutter. It needs to highlight some urls present in a string based on some logic. I find highlight_text package to do the task. This takes text and words that is to be highlighted. Everything is working fine except when i'm passing text that contains url followed by some number. It is throwing error as following:
Another exception was thrown: RangeError (index): Invalid value: Only valid value is 0: 6777 text : In a meeting, will call you later. On my wa'y Please call me later www.something.in 6777 word : www.something.in
But when url is followed by some number and then by some text, it does not throw exception and works well.
text : In a meeting, will call you later. On my way Please call me later www.something.in 6777 test text
word : www.something.in
here is my code snippet
Above code snippets preparing words that is to be highlighted.
This is where i am passing text and words. Exception is throwing at line with keyword TextHighlight. There are text of exception
Can someone please tell me what's the issue with my code? I have exhausted debugging it. It’ll be great help.