UriExtensions extension

Helpers for checking and building Uri values.

final api = Uri.parse('https://example.com/v1');
api.appendPath(['users', '42']);           // https://example.com/v1/users/42
api.withQueryParameter('page', '2');      // https://example.com/v1?page=2
api.isSecure;                             // true
on

Properties

isHttp → bool

Available on Uri, provided by the UriExtensions extension

Whether this is an http or https address.
no setter
isSecure → bool

Available on Uri, provided by the UriExtensions extension

Whether this uses an encrypted scheme (https or wss).
no setter
lastSegment → String?

Available on Uri, provided by the UriExtensions extension

The last non-empty part of the path, or null if there isn't one.
no setter

Methods

appendPath(List<String> segments) → Uri

Available on Uri, provided by the UriExtensions extension

A copy with segments added to the end of the path.
withoutQueryParameter(String key) → Uri

Available on Uri, provided by the UriExtensions extension

A copy without the query parameter key.
withQueryParameter(String key, String value) → Uri

Available on Uri, provided by the UriExtensions extension

A copy with the query parameter key set to value.