I am developing a flutter app with backend running in localhost.
I am using http package for making http calls. I am creating the Uri like this:
Uri.https("localhost:8080", "api/v1/login");
but this Uri.https
gives error, instead I need to use Uri.http
.
The problem is when the app is ready for production I will have to manually edit code everywhere to use Uri.https
instead of Uri.http
.
Is there a better way to handle this?
2
Answers
You can simple use
kReleaseMode
to detect you are in release mode or not.you can do it like this: