Generated retrofit api class should extend `not implement` abstract class to allow provision for custom endpoints implementation
Is your feature request related to a problem? Please describe.
Currently it is impossible to provide default implementation for an endpoint that i don't want generated by retrofit_generator.
Describe the solution you'd like
replacing implements with extends in the generated file. so that default implementation can be added directly in the abstract class api file.
Hi, I found a workaround, if it's still relevant for you, at least until (if) this will be changed.
If you create a constructor in your RestApi class (empty private is ok), it will generate extends implementation.
Something like this:
abstract class UserService {
Future<User> fetchUser(String id);
}
@RestApi()
abstract class UserServiceImpl implements UserService {
UserServiceImpl._();
factory UserServiceImpl(Dio dio) => _UserServiceImpl._(dio);
@override
@GET('/users/{id}')
Future<User> fetchUser(@Path('id') String id);
}
It will generate this:
class _UserServiceImpl extends UserServiceImpl {
_UserServiceImpl._(this.dio) : super._();
...
}
isnt this just... the way to do it? it needs documentation, but it works fine