endpoint method

Uri endpoint(
  1. String path, [
  2. Map<String, String> query = const {}
])

Implementation

Uri endpoint(String path, [Map<String, String> query = const {}]) {
  final basePath = baseUrl.path.endsWith('/')
      ? baseUrl.path.substring(0, baseUrl.path.length - 1)
      : baseUrl.path;
  return baseUrl.replace(
    path: '$basePath$path',
    queryParameters: query.isEmpty ? null : query,
  );
}