Issue
I am using the dart-define parameter for switching b/w URLs depending upon release or debug build in the flutter app. Now I want to integrate FastLane for CI/CD and don't know how I can use --dart-define parameter from FastLane, as I will have to use Gradle build command from FastLane.
One possible solution is to use,
const bool isProduction = bool.fromEnvironment('dart.vm.product');
as told here https://stackoverflow.com/a/52820431/9917400
But, I don't want to use this as it can only differentiate b/w prod and dev. If in the future we use a staging server, we will have to again do changes.
Solution
import 'package:flutter/foundation.dart';
if (kReleaseMode) {
Global.baseurl = "release";
} else if (kProfileMode) {
Global.baseurl = "profile";
} else {
Global.baseurl = "debug";
}
this worked for me
Answered By - Dhruv garg
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.