Skip to content

Commit

Permalink
Merge pull request #640 from leoafarias/fix/flavor-docs-checks
Browse files Browse the repository at this point in the history
Implemented better checks for flavors
  • Loading branch information
leoafarias authored Feb 21, 2024
2 parents e5c0c0f + d3d0f7b commit 2de973f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
18 changes: 5 additions & 13 deletions docs/pages/documentation/guides/project-flavors.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ It allows you to create the following configuration for your project.

```json
{
"flutterSdkVersion": "stable",
"flutter": "stable",
"flavors": {
"dev": "beta",
"staging": "2.0.3",
"production": "1.22.6"
"development": "stable",
"staging": "3.16.9",
"production": "3.10.3"
}
}
```
Expand All @@ -35,15 +35,7 @@ This will pin `version` to `flavor_name`
Will get the version configured for the flavor and set as the project version.

```bash
fvm flavor {flavor_name}
fvm use {flavor_name}
```

## View flavors

To list all configured flavors:

```bash
fvm flavor
```

[Learn more about Flutter flavors](https://flutter.dev/docs/deployment/flavors)
12 changes: 11 additions & 1 deletion lib/src/commands/use_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,21 @@ class UseCommand extends BaseCommand {
}

logger.info(
'Using Flutter SDK from "$flavorOption" which is "$flavorVersion"',
'Using Flutter SDK from flavor: "$version" which is "$flavorVersion"',
);
version = flavorVersion;
}

if (flavorOption != null) {
// check if flavor option is not a channel name or semver
if (isFlutterChannel(flavorOption)) {
throw UsageException(
'Cannot use a channel as a flavor, use a different name for flavor',
usage,
);
}
}

final cacheVersion = await ensureCacheWorkflow(version);

/// Run use workflow
Expand Down

0 comments on commit 2de973f

Please sign in to comment.