urlEncode property

String get urlEncode

Returns the URL-encoded version of the string.

Example:

String url = 'https://example.com/?q=hello world';
String encodedUrl = url.urlEncode;
print(encodedUrl); // Output: https%3A%2F%2Fexample.com%2F%3Fq%3Dhello%20world

Implementation

String get urlEncode => Uri.encodeQueryComponent(this);