If I run a Flutter web application defining a variable such as --dart-define=flavor="staging"
, is there a way to find it in Chrome Developer Tools? I have tried to look it inside the main.dart.js
file but I couldn't find it.
I need to check if Azure is setting this variable properly, because I'm uploading my Flutter web app using a task, but this variable looks like doesn't get defined properly, since the uploaded version doesn't have the things that flavor staging should have.
- task: FlutterBuild@0
inputs:
target: "web"
projectDirectory: "."
verboseMode: true
dartDefine: 'flavor="$(flavour)"'
extraArgs: "--release"
displayName: "Web Build"
Yes, actually you can do it. When you are fetching the flavor from the environment, you usually get the flavor by
String.fromEnvironment('')
,
now you can store that value in the Shared Preferences, and it will be visible under Browser-> application-> local storage. by this you can actually fetch the flavor of the web app that you are running since shared preferences uses browser's local storage api in the application.