separate the version by flavor in pubspec.yaml

31 Views Asked by At

I'm doing a project with different ones that have different versions for each flavor in pubspec.yaml

I looked and this could be a solution but when I tested it it didn't work Solution:

versios_gold: 2.1.3+1

version_light: 3.0.0+1

version_black: 1.0.0+1

Teste:

void main() {
// Gets the environment version
String version = String.fromEnvironment('version');

// Add check to ensure version is not empty
if (version.isEmpty) {
    print('Error: Version not defined correctly.');
    return;
}
    print('Version: $version');

    runApp(MyApp());
} 

Result: I/flutter (16516): Version:

0

There are 0 best solutions below