1

I want to change the version number when building my Flutter project to web platform. flutter build web --build-name=2.0.0 --build-number=2 I tried the above command but Could not find an option named "build-name". I got the error. Do you have any idea ?

MuharremCetin
  • 51
  • 1
  • 5

2 Answers2

1

You should check official documentation for the flutter build web command. You can see it with

flutter build web --help

Also you can check this open issue

https://github.com/flutter/flutter/issues/75909

Carlos Sandoval
  • 764
  • 1
  • 5
  • 16
  • Yes Carlos, thank you for your interest. I've looked at this document before, but I couldn't find a code that worked for me. **flutter build web --build-name=1.0.2 --build-number=5 --no-sound-null-safety** Do I need to add a code or make any changes for it to be active on the web? Because it seems to work for IOS and APK. – MuharremCetin Feb 17 '22 at 07:52
  • You didn't find any code because that feature is not implemented in the current Flutter version, it is still an open issue and it seems that flutter team are going to implement that in some future version. – Carlos Sandoval Feb 17 '22 at 08:00
0

Thank you guys;

I solved this problem another way. I created a PowerShell script task in Azure Pipeline. After the compilation process is complete, it replaces the version field in the version.json file with tfs build version.

$pathToJson = "$(Build.SourcesDirectory)\version.json"

$json = Get-Content $pathToJson | ConvertFrom-Json

$json.version = "$(Build.BuildNumber)"

$json | ConvertTo-Json | set-content $pathToJson
Tyler2P
  • 2,324
  • 26
  • 22
  • 31
MuharremCetin
  • 51
  • 1
  • 5