Skip to content

Commit

Permalink
fix: --dart-define not read properly (#172)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrzejchm committed Dec 17, 2021
1 parent 1249071 commit 64ebcf7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
2 changes: 1 addition & 1 deletion starport_template/ios/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ platform :ios do
)

increment_build_number(
build_number: ENV["$GITHUB_RUN_NUMBER"]
build_number: ENV["GITHUB_RUN_NUMBER"]
)

build_app(
Expand Down
30 changes: 22 additions & 8 deletions starport_template/lib/utils/base_env.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,30 @@ class BaseEnv {
final String baseApiUrl;
}

// DO NOT USE String.fromEnvironment without 'const'!!!
// https://github.com/flutter/flutter/issues/55870#issuecomment-620776138
String get envLcdPort => const String.fromEnvironment('LCD_PORT', defaultValue: '1317');

// DO NOT USE String.fromEnvironment without 'const'!!!
// https://github.com/flutter/flutter/issues/55870#issuecomment-620776138
String get envGrpcPort => const String.fromEnvironment('GRPC_PORT', defaultValue: '9090');

String get envLcdUrl => String.fromEnvironment(
'LCD_URL',
defaultValue: Platform.isAndroid ? 'http://10.0.2.2' : 'http://localhost',
);
String get envLcdUrl {
// DO NOT USE String.fromEnvironment without 'const'!!!
// https://github.com/flutter/flutter/issues/55870#issuecomment-620776138
const result = String.fromEnvironment('LCD_URL');
if (result.isEmpty) {
return Platform.isAndroid ? 'http://10.0.2.2' : 'http://localhost';
}
return result;
}

String get envGrpcUrl => String.fromEnvironment(
'GRPC_URL',
defaultValue: Platform.isAndroid ? 'http://10.0.2.2' : 'http://localhost',
);
String get envGrpcUrl {
// DO NOT USE String.fromEnvironment without 'const'!!!
// https://github.com/flutter/flutter/issues/55870#issuecomment-620776138
const result = String.fromEnvironment('GRPC_URL');
if (result.isEmpty) {
return Platform.isAndroid ? 'http://10.0.2.2' : 'http://localhost';
}
return result;
}

0 comments on commit 64ebcf7

Please sign in to comment.