'flutter build web command arguments

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 ?



Solution 1:[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

Solution 2:[2]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Carlos Sandoval
Solution 2 Tyler2P