Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented better checks for flavors #640

Merged
merged 1 commit into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading