Is your feature request related to a problem? Please describe.
Oftenly you will have different clients for different API entities like users, auth, settigns etc. As well as different envs. And it's a giant chore to have only baseUrl and adding /users, /auth, /settings to each single request.
Describe the solution you'd like
Ideal solution would be if baseUrl in constructor is defined or Dio.baseUrl is not null then add RestApi.baseUrl at the end of previous url.
Describe alternatives you've considered
To avoid breaking changes and confusion add something like RestApi.nestedUrl and if it's present then add it to the basae url.
Additional context
Ultimate goal is something like this
@RestApi(nestedUrl: '/users')
abstract class RestClient {
factory RestClient(Dio dio, {
String baseUrl // https://api.com Provided from ENV
}) = _RestClient;
@GET('/{id}') // will point towards https://api.com/users/{id}
Future<User> getUser(@Path('id') String id);
}
Is your feature request related to a problem? Please describe. Oftenly you will have different clients for different API entities like users, auth, settigns etc. As well as different envs. And it's a giant chore to have only baseUrl and adding /users, /auth, /settings to each single request.
Describe the solution you'd like Ideal solution would be if
baseUrl
in constructor is defined or Dio.baseUrl is not null then addRestApi.baseUrl
at the end of previous url.Describe alternatives you've considered To avoid breaking changes and confusion add something like
RestApi.nestedUrl
and if it's present then add it to the basae url.Additional context Ultimate goal is something like this