How to remove duplicate https:// if present in URL more than once
For example if input is "https://https://example.com"
the output should be "https://example.com"
I tried this but it didn't remove the duplicate https:// from url
void removeDuplicateHttps(String url) { String cleanedUrl = url.replaceAll(RegExp(r'https://+'), 'https://'); setState(() { linkUrlController.text = cleanedUrl; }); }