I want to use Retrofit client generation. I need to support two environments (dev and prod).
How to configure my RestClient class to support both environments?
Pass a different baseUrl depending on your entry point.
According to Retrofit official documentation, you can pass the baseUrl on run time. In other words, you can give different base URLs on different entry points.
Injectable
and GetIt
Thanks to leoshusar solution on Github,
You can use Injectable
for DI (dependency injection) with different configurations to the Retrofit
RestApi service, based on the running environment.
Checkout the full detailed example on GitHub.