appendPath method
Appends a segment to the URI path.
Uri.parse('https://api.example.com/v1').appendPath('users')
// https://api.example.com/v1/users
Implementation
Uri appendPath(String segment) {
final base = path.endsWith('/') ? path : '$path/';
final seg = segment.startsWith('/') ? segment.substring(1) : segment;
return replace(path: '$base$seg');
}