I am configuring an API endpoint using the flutter package dio
! I have two API endpoints: one for development and another for production. I want my dio
baseURL to automatically switch between development and production endpoints.
Just like so
Dio(
baseURL: isProduction ? productionBaseURL : developmentBaseURL
......
);
How to know if my app is in production environment in Dart?
Use can use flavors in flutter to setup two different environments for your app, one for testing and one for production. You can refer this official documentation.