Skip to main content
added 197 characters in body
Source Link
tapizquent
  • 909
  • 13
  • 26

I am trying to find a way to access the environment variables provided by --dart-define inside native iOS and Android code.

Is there any way to do this?

I have tried the guide explained in https://binary-studio.com/2020/06/23/flutter-3/ but that doesn't work as what gets written to the generated .xcconfig is not separated by = but instead by %3D. And I get the error

error: .../ios/Flutter/DEFINEEnvironment.xcconfig:2: expected a ‘=’, but found % (in target 'Runner' from project 'Runner')

The file DEFINEEnvironment.xcconfig gets generated with the following content MY_VAR%3DMY_VALUE instead of MY_VAR=MY_VALUE

UPDATE

This seems to be happening because when reading from the args passed to --dart-define it must be encoding = into %3D. And I don't know how prevent that from happening

I am trying to find a way to access the environment variables provided by --dart-define inside native iOS and Android code.

Is there any way to do this?

I have tried the guide explained in https://binary-studio.com/2020/06/23/flutter-3/ but that doesn't work as what gets written to the generated .xcconfig is not separated by = but instead by %3D. And I get the error

error: .../ios/Flutter/DEFINEEnvironment.xcconfig:2: expected a ‘=’, but found % (in target 'Runner' from project 'Runner')

The file DEFINEEnvironment.xcconfig gets generated with the following content MY_VAR%3DMY_VALUE instead of MY_VAR=MY_VALUE

I am trying to find a way to access the environment variables provided by --dart-define inside native iOS and Android code.

Is there any way to do this?

I have tried the guide explained in https://binary-studio.com/2020/06/23/flutter-3/ but that doesn't work as what gets written to the generated .xcconfig is not separated by = but instead by %3D. And I get the error

error: .../ios/Flutter/DEFINEEnvironment.xcconfig:2: expected a ‘=’, but found % (in target 'Runner' from project 'Runner')

The file DEFINEEnvironment.xcconfig gets generated with the following content MY_VAR%3DMY_VALUE instead of MY_VAR=MY_VALUE

UPDATE

This seems to be happening because when reading from the args passed to --dart-define it must be encoding = into %3D. And I don't know how prevent that from happening

Source Link
tapizquent
  • 909
  • 13
  • 26

Get --dart-define environment variables in native iOS and Android

I am trying to find a way to access the environment variables provided by --dart-define inside native iOS and Android code.

Is there any way to do this?

I have tried the guide explained in https://binary-studio.com/2020/06/23/flutter-3/ but that doesn't work as what gets written to the generated .xcconfig is not separated by = but instead by %3D. And I get the error

error: .../ios/Flutter/DEFINEEnvironment.xcconfig:2: expected a ‘=’, but found % (in target 'Runner' from project 'Runner')

The file DEFINEEnvironment.xcconfig gets generated with the following content MY_VAR%3DMY_VALUE instead of MY_VAR=MY_VALUE