4

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.

1 Answer 1

3
import 'package:flutter/foundation.dart';

if (kReleaseMode) {
  Global.baseurl = "release";
} else if (kProfileMode) {
  Global.baseurl = "profile";
} else {
  Global.baseurl = "debug";
}

this worked for me

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.