Trying to use retrofit with injectable but can´t implement because when I put "@Singleton" annotation on the generated retrofit code, it gets immediately deleted on save.
This is original the code:
part 'api_service.g.dart';
@RestApi(baseUrl: kBaseUrl)
abstract class ApiService {
factory ApiService(Dio dio, {String baseUrl}) = _ApiService;
@POST('/Authentication/Token')
Future<HttpResponse<User>> logInWithUsernameAndPassword(
@Field("Username") String username,
@Field("Password") String password,
@Field("Device") String device,
);
}
How could I send it as a singleton with injectable?
Thanks in advance.
P.S. I saw this answer Flutter - using retrofit with injectable but couldn't figure out how to implement it in my case.