diff --git a/docs/pages/documentation/advanced/custom-version.mdx b/docs/pages/documentation/advanced/custom-version.mdx index 56ecb96d..cf279db9 100644 --- a/docs/pages/documentation/advanced/custom-version.mdx +++ b/docs/pages/documentation/advanced/custom-version.mdx @@ -4,11 +4,11 @@ title: Custom Flutter SDK (Forks) import { Callout } from "nextra/components"; -# Custom Flutter Version (forks) +# Custom Flutter Version (Forks) -You can use custom Flutter versions (forks) within FVM cache. +You can use custom Flutter versions (forks) within the FVM cache. -To do that, you have to prefix the version with `custom_` and then add the name of the version. For example, if you want to use a custom version of Flutter, you can do the following. +To do that, you have to prefix the version with `custom_` and then add the name of the version. For example, if you want to use a custom version of Flutter, you can do the following: ```bash fvm use [custom_name] @@ -16,6 +16,6 @@ fvm use [custom_name] -Run `fvm list` to view the cache directory, and the current cached versions. +Run `fvm list` to view the cache directory and the current cached versions. - + \ No newline at end of file diff --git a/docs/pages/documentation/advanced/json-api.md b/docs/pages/documentation/advanced/json-api.md index 1d87b93a..e4fe04d8 100644 --- a/docs/pages/documentation/advanced/json-api.md +++ b/docs/pages/documentation/advanced/json-api.md @@ -23,8 +23,8 @@ fvm api list [options] **Options:** -- `--compress` (`-c`): Outputs JSON with no whitespace. -- `--skip-size-calculation` (`-s`): Skips calculating the size of cached versions. +- `--compress` (`-c`): Outputs JSON with no whitespace. +- `--skip-size-calculation` (`-s`): Skips calculating the size of cached versions. **Response Payload:** @@ -63,10 +63,9 @@ fvm api releases [options] **Options:** -- `--compress`: Outputs JSON with no whitespace. -- `--limit [number]`: Limits the number of releases listed. -- `--filter-channel [channel]`: Filters the releases by channel. Available channels are `stable`, `beta`, and `dev`. - +- `--compress`: Outputs JSON with no whitespace. +- `--limit [number]`: Limits the number of releases listed. +- `--filter-channel [channel]`: Filters the releases by channel. Available channels are `stable`, `beta`, and `dev`. **Response Payload:** @@ -107,13 +106,12 @@ fvm api context [options] **Options:** -- `--compress`: Outputs JSON with no whitespace. +- `--compress`: Outputs JSON with no whitespace. **Response Payload:** ```json { - "context": { "fvmVersion": "3.0.14", "workingDirectory": "/path/to/project", @@ -125,7 +123,7 @@ fvm api context [options] "flutterUrl": "https://github.com/flutter/flutter.git", "lastUpdateCheck": "2024-03-13T14:46:08.735250Z", "updateCheckDisabled": false, - "priviledgedAccess": false, + "privilegedAccess": false, "globalCacheLink": "/path/to/.fvm/default", "globalCacheBinPath": "/path/to/.fvm/default/bin", "versionsCachePath": "/path/to/.fvm/versions", @@ -135,7 +133,7 @@ fvm api context [options] "args": [ "api", "info" - ], + ] } } ``` @@ -152,8 +150,8 @@ fvm api project [options] **Options:** -- `--compress`: Outputs JSON with no whitespace. -- `--path [path]`: The path to the project. Defaults to the current working directory. +- `--compress`: Outputs JSON with no whitespace. +- `--path [path]`: The path to the project. Defaults to the current working directory. **Response Payload:** @@ -203,12 +201,12 @@ fvm api project [options] ... }, "dev_dependencies": { - ... + ... }, "flutter": { - "uses-material-design": true, - }, - }, + "uses-material-design": true + } + } } } ``` diff --git a/docs/pages/documentation/getting-started/configuration.mdx b/docs/pages/documentation/getting-started/configuration.mdx index 3b06c312..8db91618 100644 --- a/docs/pages/documentation/getting-started/configuration.mdx +++ b/docs/pages/documentation/getting-started/configuration.mdx @@ -12,11 +12,11 @@ Configure FVM and IDEs for better support for different development environments ## Project -There are two main parts for a project that has FVM configured. The `.fvmrc` config file and the `.fvm` directory. +There are two main parts for a project that has FVM configured: the `.fvmrc` config file and the `.fvm` directory. ### Config File `.fvmrc` -This contains version linked to the project. This file is automatically created when you run `fvm use {version}`. Here you can also find project specific settings, and flavors. +This contains the version linked to the project. This file is automatically created when you run `fvm use {version}`. Here you can also find project-specific settings and flavors. ```json { @@ -31,20 +31,20 @@ This contains version linked to the project. This file is automatically created } ``` -- `flutter`: The version of the Flutter SDK to be used, falling back to the flutter value if not explicitly set. -- `cachePath`: Defines the path to the project's cache directory. -- `useGitCache`: (default: true) Indicates whether the Git cache is used for dependencies. -- `gitCachePath`: Sets the path to the Git cache directory, applicable if useGitCache is true. -- `flutterUrl`: Specifies the URL to the Flutter SDK repository. -- `priviledgedAccess`:(default: true) Determines if configurations requiring elevated permissions are enabled. -- `flavors`: A map defining custom project flavors for different configurations. -- `updateVscodeSettings`: (default: true) Flags whether to auto-update VS Code settings on configuration changes. -- `updateGitIgnore`: (default:true) Indicates whether to auto-update the .gitignore file based on project configurations. -- `runPubGetOnSdkChanges`: (default: true) Triggers flutter pub get automatically upon Flutter SDK version changes. +- `flutter`: The version of the Flutter SDK to be used, falling back to the flutter value if not explicitly set. +- `cachePath`: Defines the path to the project's cache directory. +- `useGitCache`: (default: true) Indicates whether the Git cache is used for dependencies. +- `gitCachePath`: Sets the path to the Git cache directory, applicable if useGitCache is true. +- `flutterUrl`: Specifies the URL to the Flutter SDK repository. +- `privilegedAccess`: (default: true) Determines if configurations requiring elevated permissions are enabled. +- `flavors`: A map defining custom project flavors for different configurations. +- `updateVscodeSettings`: (default: true) Flags whether to auto-update VS Code settings on configuration changes. +- `updateGitIgnore`: (default: true) Indicates whether to auto-update the .gitignore file based on project configurations. +- `runPubGetOnSdkChanges`: (default: true) Triggers flutter pub get automatically upon Flutter SDK version changes. ### .fvm Directory -Inside the directory you will find the following files and directories: +Inside the directory, you will find the following files and directories: @@ -59,16 +59,16 @@ Inside the directory you will find the following files and directories: -- **flutter_sdk** - Symlink to the Flutter SDK version linked to the project. -- **versions** - Directory containing the Flutter SDK versions. This is similar to flutter_sdk, but is used for better VsCode compatibility. -- **fvm_config.json** - (deprecated) This is a legacy configuration file. -- **release** - (internal use only) File containing the release version of FVM. -- **version** - (internal use only) File containing the version of FVM. +- **flutter_sdk** - Symlink to the Flutter SDK version linked to the project. +- **versions** - Directory containing the Flutter SDK versions. This is similar to flutter_sdk but is used for better VS Code compatibility. +- **fvm_config.json** - (deprecated) This is a legacy configuration file. +- **release** - (internal use only) File containing the release version of FVM. +- **version** - (internal use only) File containing the version of FVM. - Starting version 3.0 and above it is recommended to add the `.fvm` directory + Starting with version 3.0 and above, it is recommended to add the `.fvm` directory to your `.gitignore` file. FVM will automatically add it to .gitignore when - pinning a version to a project, if `updateGitIgnore` is set to `true`. + pinning a version to a project if `updateGitIgnore` is set to `true`. ## Environment Variables @@ -77,8 +77,8 @@ Set environment variables at the system level to apply configurations globally. ## Supported Environment Variables: -- `FVM_CACHE_PATH`: Specifies the cache path for Flutter versions. -- `FVM_USE_GIT_CACHE`: Enables/disables the git cache globally (`true`/`false`). -- `FVM_GIT_CACHE_PATH`: Sets the path for the local git reference cache. -- `FVM_FLUTTER_URL`: Defines the Flutter repository git URL. -- `FVM_PRIVILEDGED_ACCESS`: Enables/disables privileged access for FVM (`true`/`false`). +- `FVM_CACHE_PATH`: Specifies the cache path for Flutter versions. +- `FVM_USE_GIT_CACHE`: Enables/disables the git cache globally (`true`/`false`). +- `FVM_GIT_CACHE_PATH`: Sets the path for the local git reference cache. +- `FVM_FLUTTER_URL`: Defines the Flutter repository git URL. +- `FVM_PRIVILEGED_ACCESS`: Enables/disables privileged access for FVM (`true`/`false`). \ No newline at end of file diff --git a/docs/pages/documentation/getting-started/faq.md b/docs/pages/documentation/getting-started/faq.md index 87b53ae8..8d34fa5d 100644 --- a/docs/pages/documentation/getting-started/faq.md +++ b/docs/pages/documentation/getting-started/faq.md @@ -5,84 +5,84 @@ title: FAQ # FAQ -### Upgrade Flutter Channel +## Upgrade Flutter Channel -As described in our [Principles](../getting-started/#principles) FVM does not override standard Flutter behavior. Therefore to upgrade a channel you will have to use standard `flutter upgrade`. You can find more about it in the [Running Flutter](../guides/running-flutter) section. +As described in our [Principles](../getting-started/#principles), FVM does not override standard Flutter behavior. Therefore, to upgrade a channel, you will have to use the standard `flutter upgrade`. You can find more about it in the [Running Flutter](../guides/running-flutter) section. --- -### Cannot install latest version of FVM +## Cannot install the latest version of FVM -When running `dart pub global activate fvm`, pub will grab the latest FVM version that is compatible with the installed dart-sdk. Upgrade to the latest version of the Dart, and run the command again. Go to https://dart.dev/get-dart for more information. +When running `dart pub global activate fvm`, pub will grab the latest FVM version that is compatible with the installed dart-sdk. Upgrade to the latest version of Dart, and run the command again. Go to [get dart](https://dart.dev/get-dart) for more information. --- -### How to uninstall FVM +## How to uninstall FVM -Run command `fvm destroy` to remove FVM from your system. -If you installed using pub run `dart pub global deactivate fvm`, if you used a standalone installation please follow its instructions. +Run the command `fvm destroy` to remove FVM from your system. +If you installed using pub, run `dart pub global deactivate fvm`. If you used a standalone installation, please follow its instructions. --- -### Commands run twice on Windows +## Commands run twice on Windows -This happens due to a pub issue https://github.com/dart-lang/pub/issues/2934. To avoid this issue from happening make sure you PATH is in the following order. [Please read the following](#environment-variables-order-for-windows-in-path). +This happens due to a pub issue [dart-lang:2934](https://github.com/dart-lang/pub/issues/2934). To avoid this issue from happening, make sure your PATH is in the following order. [Please read the following](#environment-variables-order-for-windows-in-path). --- -### Invalid kernel binary or invalid sdk hash when running FVM +## Invalid kernel binary or invalid SDK hash when running FVM -There are a few reasons this can happen. However it means that the FVM snapshot is not compatible with the Dart version that is installed. +There are a few reasons this can happen. However, it means that the FVM snapshot is not compatible with the Dart version that is installed. Please do the following: -1. On Windows make sure your env variables are in the following order as described [here](#environment-variables-order-for-windows-in-path). -2. Run `dart pub global deactivate fvm` -3. Run `dart pub global activate fvm` +1. On Windows, make sure your environment variables are in the following order as described [here](#environment-variables-order-for-windows-in-path). +2. Run `dart pub global deactivate fvm`. +3. Run `dart pub global activate fvm`. --- -### Command 'pub' not found +## Command 'pub' not found -If you get `Command 'pub' not found`, then make sure to append `export PATH="$PATH:/usr/lib/dart/bin"` to your `~/.bashrc` (gets reiniated each time you open a bash shell) or `~/.profile` (only read at login) file. +If you get `Command 'pub' not found`, then make sure to append `export PATH="$PATH:/usr/lib/dart/bin"` to your `~/.bashrc` (gets reinitiated each time you open a bash shell) or `~/.profile` (only read at login) file. --- -### Environment variables order for Windows in PATH +## Environment variables order for Windows in PATH -Flutter comes with Dart embedded. Because of that you can find some conflicts when running standalone Dart and Flutter together. Here is a suggestion of what we found to be the correct order of dependencies to avoid issues. +Flutter comes with Dart embedded. Because of that, you can find some conflicts when running standalone Dart and Flutter together. Here is a suggestion of what we found to be the correct order of dependencies to avoid issues. 1. Pub Cache for global packages 2. Dart SDK (if installed outside of Flutter) 3. Flutter SDK -It should look like this. +It should look like this: -``` +```bash C:\Users\\AppData\Roaming\Pub\Cache\bin C:\src\flutter\bin\cache\dart-sdk\bin C:\src\flutter\bin ``` -### Git not found after install on Windows +## Git not found after install on Windows Some users may be greeted by this error after installing FVM in a project. -``` +```bash Error: Unable to find git in your PATH. ``` -This happens because of a security update from git where Git now checks for ownership of the folder trying to ensure that the folder you are using Git in has the same user as the owner as your current user account. +This happens because of a security update from Git where Git now checks for ownership of the folder, trying to ensure that the folder you are using Git in has the same user as the owner as your current user account. To fix this, we need to mark our repos as safe using the following command: -``` +```bash git config --global --add safe.directory '*' ``` -Restart your terminals and VS Code after running this command. This should fix the issue +Restart your terminals and VS Code after running this command. This should fix the issue. -If you don’t want to mark all the repos as safe, then you can mark only the flutter repo as safe by passing the flutter path instead of * +If you don’t want to mark all the repos as safe, then you can mark only the Flutter repo as safe by passing the Flutter path instead of `*`: -``` +```bash git config --global --add safe.directory C:\Users\someUser\flutter\.git\ ``` diff --git a/docs/pages/documentation/getting-started/index.md b/docs/pages/documentation/getting-started/index.md index b80daa0b..911c3e71 100644 --- a/docs/pages/documentation/getting-started/index.md +++ b/docs/pages/documentation/getting-started/index.md @@ -13,12 +13,12 @@ FVM helps with the need for consistent app builds by referencing the Flutter SDK - Testing new SDK features requires switching between [Channels](https://flutter.dev/docs/development/tools/sdk/releases). - The switch between channels is slow and requires reinstalling every time. - No way of keeping track of the latest working/used version of the SDK in an app. -- Major Flutter updates require migration of all Flutter apps in the machine. +- Major Flutter updates require migration of all Flutter apps on the machine. - Inconsistent development environments between other devs in the team. ## Video Guides & Walkthroughs -You can view a playlist of many Youtube guides & walkthroughs done by the incredible Flutter community in many different languages. +You can view a playlist of many YouTube guides & walkthroughs done by the incredible Flutter community in many different languages. @@ -28,13 +28,12 @@ We follow these principles when building and adding new features to FVM. - Always use Flutter tools when interacting with the SDK. - Do not override any Flutter CLI commands. -- Follow Flutter suggested installation instructions accomplish caching. +- Follow Flutter suggested installation instructions to accomplish caching. - Should extend Flutter behavior and not modify them. - API should be simple and easy to understand. ## Contributors - diff --git a/docs/pages/documentation/getting-started/installation.mdx b/docs/pages/documentation/getting-started/installation.mdx index eda3fd29..15ee4f44 100644 --- a/docs/pages/documentation/getting-started/installation.mdx +++ b/docs/pages/documentation/getting-started/installation.mdx @@ -11,7 +11,7 @@ There are a few ways to install FVM, and we are working on other ways to make it ## Recommendation -We recommend install Flutter SDK globally using the official installation guide [here](https://docs.flutter.dev/get-started/install). This will be the main version of Flutter across your machine. +We recommend installing the Flutter SDK globally using the official installation guide [here](https://docs.flutter.dev/get-started/install). This will be the main version of Flutter across your machine. Use FVM to manage the Flutter SDK version for your projects. @@ -44,7 +44,7 @@ brew untap leoafarias/fvm -To install fvm (Install), run the following command from the command line or from PowerShell: +To install FVM (Install), run the following command from the command line or from PowerShell: ```bash choco install fvm @@ -78,13 +78,12 @@ brew untap leoafarias/fvm -You are able to also install FVM as a [pub package](https://pub.dev/packages/fvm). +You are also able to install FVM as a [pub package](https://pub.dev/packages/fvm). -However if you plan on using FVM to manage your [global Flutter install](/docs/guides/global_version) we recommend installing as a standalone. +However, if you plan on using FVM to manage your [global Flutter install](/docs/guides/global_version), we recommend installing it as a standalone. - This is not recommended if you plan on using FVM to manage your global Flutter - install. + This is not recommended if you plan on using FVM to manage your global Flutter install. ```bash @@ -92,4 +91,4 @@ dart pub global activate fvm ``` - + \ No newline at end of file diff --git a/docs/pages/documentation/guides/basic-commands.mdx b/docs/pages/documentation/guides/basic-commands.mdx index 8df1f81c..3e93cf35 100644 --- a/docs/pages/documentation/guides/basic-commands.mdx +++ b/docs/pages/documentation/guides/basic-commands.mdx @@ -18,7 +18,7 @@ import { # Commands -This a reference of essential FVM commands to help you efficiently manage multiple Flutter SDK versions across your projects. +This is a reference of essential FVM commands to help you efficiently manage multiple Flutter SDK versions across your projects. ## Use @@ -34,15 +34,11 @@ Sets a specific Flutter SDK version for a project, ensuring environment consiste ### Options -- `-f, --force`: Bypasses Flutter project checks, assuming version compatibility. - -- `-p, --pin`: Pins the latest release of a specified channel. - -- `--flavor`: Specifies the SDK version for a particular project flavor in multi-flavored projects. - -- `-s,--skip-setup`: Omits Flutter setup post-installation for expedited process. - -- `--skip-pub-get`: Skip resolving dependencies (`flutter pub get`) after switching Flutter SDK. +- `-f, --force`: Bypasses Flutter project checks, assuming version compatibility. +- `-p, --pin`: Pins the latest release of a specified channel. +- `--flavor`: Specifies the SDK version for a particular project flavor in multi-flavored projects. +- `-s, --skip-setup`: Omits Flutter setup post-installation for expedited process. +- `--skip-pub-get`: Skips resolving dependencies (`flutter pub get`) after switching Flutter SDK. ### Examples @@ -66,9 +62,9 @@ If you want to pin this channel to its current latest release, use the `--pin` f fvm use stable -p ``` -**Using a commit hash**: +**Using a Commit Hash**: -You are able to install and bind a specific framework revision by providing the git commit or short hash. +You can install and bind a specific framework revision by providing the git commit or short hash. ```bash ## Short hash @@ -91,7 +87,7 @@ For a project with multiple flavors, set a version for a specific flavor like th fvm use 2.2.3 --flavor production ``` -**Using a Flavor** +**Using a Flavor** To switch to a specific flavor, you can use the `use` command with the name of the flavor: ```bash @@ -112,7 +108,7 @@ Without `[version]`, installs the version specified in the project's FVM setting ### Options -- `-s, --setup`: Builds the SDK post-installation for immediate readiness. +- `-s, --setup`: Builds the SDK post-installation for immediate readiness. ### Examples @@ -174,7 +170,7 @@ The `releases` command in FVM (Flutter Version Management) allows you to view al ### Options -- `-c, --channel [channel_name]`: Filter the releases by a specific channel (e.g., `stable`, `beta`, `dev`). If no channel is specified, it defaults to showing releases from the `stable` channel. +- `-c, --channel [channel_name]`: Filter the releases by a specific channel (e.g., `stable`, `beta`, `dev`). If no channel is specified, it defaults to showing releases from the `stable` channel. ### Examples @@ -227,9 +223,8 @@ The `global` command in FVM (Flutter Version Management) is used to set a specif ### Options -- `-f, --force`: Bypasses Flutter project checks. - -- `-u, --unlink`: Unlinks the global version, reverting to the default Flutter SDK version. +- `-f, --force`: Bypasses Flutter project checks. +- `-u, --unlink`: Unlinks the global version, reverting to the default Flutter SDK version. ### Examples @@ -240,7 +235,7 @@ To set Flutter SDK version `2.5.0` as your global version, you would run: fvm global 2.5.0 ``` -**Unlinking the Global Version**: +**Unlinking the Global Version**: To unlink the global version, you can run: ```bash @@ -334,7 +329,7 @@ fvm destroy The `flavor` command is used to execute Flutter commands using a specific Flutter SDK version defined by a project flavor. -This command is particularly useful when you need to run a Flutter command (such as flutter build) with a version of the SDK associated with a particular flavor of your project. +This command is particularly useful when you need to run a Flutter command (such as `flutter build`) with a version of the SDK associated with a particular flavor of your project. ### Usage @@ -349,13 +344,15 @@ This command is particularly useful when you need to run a Flutter command (such `[flutter_command_args]`: Any additional arguments you want to pass to the Flutter command. ### Examples -**Running a Build with a Specific Flavor**: + +**Running a Build with a Specific Flavor**: To build your Flutter project using the Flutter SDK version associated with the `development` flavor: ```bash > fvm flavor development flutter build ``` -**Running Tests with a Different Flavor**: + +**Running Tests with a Different Flavor**: If you need to run tests using the Flutter SDK version associated with the `staging` flavor: ```bash diff --git a/docs/pages/documentation/guides/monorepo.md b/docs/pages/documentation/guides/monorepo.md index 061039f6..7d78e08c 100644 --- a/docs/pages/documentation/guides/monorepo.md +++ b/docs/pages/documentation/guides/monorepo.md @@ -11,7 +11,7 @@ FVM helps ensure that all projects or packages within a monorepo utilize a consi A shared `pubspec.yaml` at the monorepo's root is beneficial for projects with common dependencies, ensuring they all adhere to a unified Flutter SDK version. -Melos requires a `pubspec.yaml` at the root of the monorepo. Running `fvm use` at the root of the monorepo will generate a `.fvmrc` file to be generate at the root, and will allow or packages to use the same Flutter SDK version. +Melos requires a `pubspec.yaml` at the root of the monorepo. Running `fvm use` at the root of the monorepo will generate a `.fvmrc` file at the root, allowing all packages to use the same Flutter SDK version. Specify the Flutter SDK version in `melos.yaml`. This configuration ensures that all scripts and Melos commands utilize the designated Flutter SDK version, maintaining consistency across the monorepo. @@ -21,4 +21,4 @@ For detailed configuration instructions, refer to the [sdkPath](https://melos.in This setup involves repositories segmented into subfolders, with each housing a distinct Flutter project, and lacking a unified monorepo management tool. -Run `fvm use` at the root folder of the Flutter projects to generate a `.fvmrc` file. Now, each project can use the same Flutter SDK version. +Run `fvm use` at the root folder of the Flutter projects to generate a `.fvmrc` file. Now, each project can use the same Flutter SDK version. \ No newline at end of file diff --git a/docs/pages/documentation/guides/project-flavors.md b/docs/pages/documentation/guides/project-flavors.md index dcb37909..c6eca873 100644 --- a/docs/pages/documentation/guides/project-flavors.md +++ b/docs/pages/documentation/guides/project-flavors.md @@ -5,7 +5,7 @@ title: Project Flavors # Project Flavors -You can have multiple Flutter SDK versions configured per project environment or release type. FVM follows the same convention of Flutter and calls this `flavors`. +You can have multiple Flutter SDK versions configured per project environment or release type. FVM follows the same convention as Flutter and calls this `flavors`. It allows you to create the following configuration for your project. @@ -22,28 +22,26 @@ It allows you to create the following configuration for your project. ## Pin flavor version -To choose a Flutter SDK version for a specific flavor you just use the `use` command. +To choose a Flutter SDK version for a specific flavor, you just use the `use` command. ```bash fvm use {version} --flavor {flavor_name} ``` -This will pin `version` to `flavor_name` +This will pin `version` to `flavor_name`. ## Switch flavors -Will get the version configured for the flavor and set as the project version. +This will get the version configured for the flavor and set it as the project version. ```bash fvm use {flavor_name} ``` -## Spwan a command with a flavor version +## Spawn a command with a flavor version -Will get the version configured for the flavor and use to run a Flutter command. +This will get the version configured for the flavor and use it to run a Flutter command. ```bash fvm flavor {flavor_name} {flutter_command} {flutter_command_args} ``` - - diff --git a/docs/pages/documentation/guides/running-flutter.mdx b/docs/pages/documentation/guides/running-flutter.mdx index dad412aa..54b278e8 100644 --- a/docs/pages/documentation/guides/running-flutter.mdx +++ b/docs/pages/documentation/guides/running-flutter.mdx @@ -48,13 +48,13 @@ f run ### Benefits -- Find relative project configurations. -- Monorepo compatibility. -- Fallback to `global` configured version or `PATH` configured. +- Find relative project configurations. +- Monorepo compatibility. +- Fallback to `global` configured version or `PATH` configured. ### Routing -When proxying commands, `FVM` will look for an sdk in the following order. +When proxying commands, `FVM` will look for an SDK in the following order. 1. Project 2. Ancestor directory @@ -96,4 +96,4 @@ The following will run `flutter analyze` on the `master` channel ```bash fvm spawn master analyze -``` +``` \ No newline at end of file diff --git a/docs/pages/documentation/guides/vscode.mdx b/docs/pages/documentation/guides/vscode.mdx index c96d8d4d..c13c58b5 100644 --- a/docs/pages/documentation/guides/vscode.mdx +++ b/docs/pages/documentation/guides/vscode.mdx @@ -28,19 +28,19 @@ Upon detection, FVM automatically updates the .vscode/settings.json file within } ``` -## Integation witih Dart Code Extension +## Integration with Dart Code Extension The [Dart Code extension](https://marketplace.visualstudio.com/items?itemName=Dart-Code.dart-code) for VSCode, essential for Flutter development, responds to the SDK path changes made by FVM. It notifies you about the environment change through the terminal and automatically switches to the new Flutter SDK version for both terminal commands and IDE tools. ## Benefits of FVM Integration -- **Simplified SDK Management**: Automatically switches between Flutter SDK versions based on project requirements without manual configuration changes. -- **Consistent Development Environment**: Ensures all developers in a team are using the same Flutter SDK version, as specified by FVM configuration. -- **Enhanced Workflow**: Removes the need to prefix commands with fvm in the Visual Studio Code terminal, allowing you to use flutter commands directly. +- **Simplified SDK Management**: Automatically switches between Flutter SDK versions based on project requirements without manual configuration changes. +- **Consistent Development Environment**: Ensures all developers in a team are using the same Flutter SDK version, as specified by FVM configuration. +- **Enhanced Workflow**: Removes the need to prefix commands with fvm in the Visual Studio Code terminal, allowing you to use flutter commands directly. With the Dart Code extension's automatic SDK path update, the `flutter` - command within VSCode terminal will reference the Flutter SDK version managed + command within the VSCode terminal will reference the Flutter SDK version managed by FVM, not the version installed globally on your system or specified in your OS environment PATH. - + \ No newline at end of file diff --git a/lib/src/models/config_model.dart b/lib/src/models/config_model.dart index 5a802225..53541094 100644 --- a/lib/src/models/config_model.dart +++ b/lib/src/models/config_model.dart @@ -23,7 +23,7 @@ enum ConfigKeys { gitCachePath(description: 'Path where local Git reference cache is stored'), flutterUrl(description: 'Flutter repository Git URL to clone from'), - priviledgedAccess(description: 'Enable/Disable priviledged access for FVM'); + privilegedAccess(description: 'Enable/Disable priviledged access for FVM'); const ConfigKeys({required this.description}); @@ -65,10 +65,10 @@ enum ConfigKeys { help: ConfigKeys.flutterUrl.description, ); }, - ConfigKeys.priviledgedAccess: () { + ConfigKeys.privilegedAccess: () { argParser.addFlag( - ConfigKeys.priviledgedAccess.paramKey, - help: ConfigKeys.priviledgedAccess.description, + ConfigKeys.privilegedAccess.paramKey, + help: ConfigKeys.privilegedAccess.description, defaultsTo: true, negatable: true, ); @@ -136,7 +136,7 @@ class FileConfig extends BaseConfig with FileConfigMappable { final bool? runPubGetOnSdkChanges; /// If FVM should run with priviledged access - final bool? priviledgedAccess; + final bool? privilegedAccess; static final fromMap = FileConfigMapper.fromMap; static final fromJson = FileConfigMapper.fromJson; @@ -147,7 +147,7 @@ class FileConfig extends BaseConfig with FileConfigMappable { required super.useGitCache, required super.gitCachePath, required super.flutterUrl, - required this.priviledgedAccess, + required this.privilegedAccess, required this.runPubGetOnSdkChanges, required this.updateVscodeSettings, required this.updateGitIgnore, @@ -178,7 +178,7 @@ class AppConfig extends FileConfig with AppConfigMappable { super.useGitCache, super.gitCachePath, super.flutterUrl, - super.priviledgedAccess, + super.privilegedAccess, super.runPubGetOnSdkChanges, super.updateVscodeSettings, super.updateGitIgnore, @@ -192,7 +192,7 @@ class AppConfig extends FileConfig with AppConfigMappable { useGitCache: null, gitCachePath: null, flutterUrl: null, - priviledgedAccess: null, + privilegedAccess: null, runPubGetOnSdkChanges: null, updateVscodeSettings: null, updateGitIgnore: null, @@ -226,7 +226,7 @@ class AppConfig extends FileConfig with AppConfigMappable { useGitCache: config.useGitCache, gitCachePath: config.gitCachePath, flutterUrl: config.flutterUrl, - priviledgedAccess: config.priviledgedAccess, + privilegedAccess: config.privilegedAccess, runPubGetOnSdkChanges: config.runPubGetOnSdkChanges, updateVscodeSettings: config.updateVscodeSettings, updateGitIgnore: config.updateGitIgnore, @@ -262,7 +262,7 @@ class ProjectConfig extends FileConfig with ProjectConfigMappable { super.useGitCache, super.gitCachePath, super.flutterUrl, - super.priviledgedAccess, + super.privilegedAccess, super.runPubGetOnSdkChanges, super.updateVscodeSettings, super.updateGitIgnore, @@ -276,7 +276,7 @@ class ProjectConfig extends FileConfig with ProjectConfigMappable { useGitCache: null, gitCachePath: null, flutterUrl: null, - priviledgedAccess: null, + privilegedAccess: null, runPubGetOnSdkChanges: null, updateVscodeSettings: null, updateGitIgnore: null, diff --git a/lib/src/models/config_model.mapper.dart b/lib/src/models/config_model.mapper.dart index 5dbe57ef..38d120eb 100644 --- a/lib/src/models/config_model.mapper.dart +++ b/lib/src/models/config_model.mapper.dart @@ -33,8 +33,8 @@ class ConfigKeysMapper extends EnumMapper { return ConfigKeys.gitCachePath; case 'flutterUrl': return ConfigKeys.flutterUrl; - case 'priviledgedAccess': - return ConfigKeys.priviledgedAccess; + case 'privilegedAccess': + return ConfigKeys.privilegedAccess; default: throw MapperException.unknownEnumValue(value); } @@ -51,8 +51,8 @@ class ConfigKeysMapper extends EnumMapper { return 'gitCachePath'; case ConfigKeys.flutterUrl: return 'flutterUrl'; - case ConfigKeys.priviledgedAccess: - return 'priviledgedAccess'; + case ConfigKeys.privilegedAccess: + return 'privilegedAccess'; } } } @@ -302,9 +302,9 @@ class FileConfigMapper extends ClassMapperBase { static String? _$flutterUrl(FileConfig v) => v.flutterUrl; static const Field _f$flutterUrl = Field('flutterUrl', _$flutterUrl); - static bool? _$priviledgedAccess(FileConfig v) => v.priviledgedAccess; - static const Field _f$priviledgedAccess = - Field('priviledgedAccess', _$priviledgedAccess); + static bool? _$privilegedAccess(FileConfig v) => v.privilegedAccess; + static const Field _f$privilegedAccess = + Field('privilegedAccess', _$privilegedAccess); static bool? _$runPubGetOnSdkChanges(FileConfig v) => v.runPubGetOnSdkChanges; static const Field _f$runPubGetOnSdkChanges = Field('runPubGetOnSdkChanges', _$runPubGetOnSdkChanges); @@ -321,7 +321,7 @@ class FileConfigMapper extends ClassMapperBase { #useGitCache: _f$useGitCache, #gitCachePath: _f$gitCachePath, #flutterUrl: _f$flutterUrl, - #priviledgedAccess: _f$priviledgedAccess, + #privilegedAccess: _f$privilegedAccess, #runPubGetOnSdkChanges: _f$runPubGetOnSdkChanges, #updateVscodeSettings: _f$updateVscodeSettings, #updateGitIgnore: _f$updateGitIgnore, @@ -335,7 +335,7 @@ class FileConfigMapper extends ClassMapperBase { useGitCache: data.dec(_f$useGitCache), gitCachePath: data.dec(_f$gitCachePath), flutterUrl: data.dec(_f$flutterUrl), - priviledgedAccess: data.dec(_f$priviledgedAccess), + privilegedAccess: data.dec(_f$privilegedAccess), runPubGetOnSdkChanges: data.dec(_f$runPubGetOnSdkChanges), updateVscodeSettings: data.dec(_f$updateVscodeSettings), updateGitIgnore: data.dec(_f$updateGitIgnore)); @@ -398,7 +398,7 @@ abstract class FileConfigCopyWith<$R, $In extends FileConfig, $Out> bool? useGitCache, String? gitCachePath, String? flutterUrl, - bool? priviledgedAccess, + bool? privilegedAccess, bool? runPubGetOnSdkChanges, bool? updateVscodeSettings, bool? updateGitIgnore}); @@ -419,7 +419,7 @@ class _FileConfigCopyWithImpl<$R, $Out> Object? useGitCache = $none, Object? gitCachePath = $none, Object? flutterUrl = $none, - Object? priviledgedAccess = $none, + Object? privilegedAccess = $none, Object? runPubGetOnSdkChanges = $none, Object? updateVscodeSettings = $none, Object? updateGitIgnore = $none}) => @@ -428,7 +428,7 @@ class _FileConfigCopyWithImpl<$R, $Out> if (useGitCache != $none) #useGitCache: useGitCache, if (gitCachePath != $none) #gitCachePath: gitCachePath, if (flutterUrl != $none) #flutterUrl: flutterUrl, - if (priviledgedAccess != $none) #priviledgedAccess: priviledgedAccess, + if (privilegedAccess != $none) #privilegedAccess: privilegedAccess, if (runPubGetOnSdkChanges != $none) #runPubGetOnSdkChanges: runPubGetOnSdkChanges, if (updateVscodeSettings != $none) @@ -441,8 +441,8 @@ class _FileConfigCopyWithImpl<$R, $Out> useGitCache: data.get(#useGitCache, or: $value.useGitCache), gitCachePath: data.get(#gitCachePath, or: $value.gitCachePath), flutterUrl: data.get(#flutterUrl, or: $value.flutterUrl), - priviledgedAccess: - data.get(#priviledgedAccess, or: $value.priviledgedAccess), + privilegedAccess: + data.get(#privilegedAccess, or: $value.privilegedAccess), runPubGetOnSdkChanges: data.get(#runPubGetOnSdkChanges, or: $value.runPubGetOnSdkChanges), updateVscodeSettings: @@ -488,9 +488,9 @@ class AppConfigMapper extends ClassMapperBase { static String? _$flutterUrl(AppConfig v) => v.flutterUrl; static const Field _f$flutterUrl = Field('flutterUrl', _$flutterUrl, opt: true); - static bool? _$priviledgedAccess(AppConfig v) => v.priviledgedAccess; - static const Field _f$priviledgedAccess = - Field('priviledgedAccess', _$priviledgedAccess, opt: true); + static bool? _$privilegedAccess(AppConfig v) => v.privilegedAccess; + static const Field _f$privilegedAccess = + Field('privilegedAccess', _$privilegedAccess, opt: true); static bool? _$runPubGetOnSdkChanges(AppConfig v) => v.runPubGetOnSdkChanges; static const Field _f$runPubGetOnSdkChanges = Field('runPubGetOnSdkChanges', _$runPubGetOnSdkChanges, opt: true); @@ -509,7 +509,7 @@ class AppConfigMapper extends ClassMapperBase { #useGitCache: _f$useGitCache, #gitCachePath: _f$gitCachePath, #flutterUrl: _f$flutterUrl, - #priviledgedAccess: _f$priviledgedAccess, + #privilegedAccess: _f$privilegedAccess, #runPubGetOnSdkChanges: _f$runPubGetOnSdkChanges, #updateVscodeSettings: _f$updateVscodeSettings, #updateGitIgnore: _f$updateGitIgnore, @@ -525,7 +525,7 @@ class AppConfigMapper extends ClassMapperBase { useGitCache: data.dec(_f$useGitCache), gitCachePath: data.dec(_f$gitCachePath), flutterUrl: data.dec(_f$flutterUrl), - priviledgedAccess: data.dec(_f$priviledgedAccess), + privilegedAccess: data.dec(_f$privilegedAccess), runPubGetOnSdkChanges: data.dec(_f$runPubGetOnSdkChanges), updateVscodeSettings: data.dec(_f$updateVscodeSettings), updateGitIgnore: data.dec(_f$updateGitIgnore)); @@ -589,7 +589,7 @@ abstract class AppConfigCopyWith<$R, $In extends AppConfig, $Out> bool? useGitCache, String? gitCachePath, String? flutterUrl, - bool? priviledgedAccess, + bool? privilegedAccess, bool? runPubGetOnSdkChanges, bool? updateVscodeSettings, bool? updateGitIgnore}); @@ -612,7 +612,7 @@ class _AppConfigCopyWithImpl<$R, $Out> Object? useGitCache = $none, Object? gitCachePath = $none, Object? flutterUrl = $none, - Object? priviledgedAccess = $none, + Object? privilegedAccess = $none, Object? runPubGetOnSdkChanges = $none, Object? updateVscodeSettings = $none, Object? updateGitIgnore = $none}) => @@ -624,7 +624,7 @@ class _AppConfigCopyWithImpl<$R, $Out> if (useGitCache != $none) #useGitCache: useGitCache, if (gitCachePath != $none) #gitCachePath: gitCachePath, if (flutterUrl != $none) #flutterUrl: flutterUrl, - if (priviledgedAccess != $none) #priviledgedAccess: priviledgedAccess, + if (privilegedAccess != $none) #privilegedAccess: privilegedAccess, if (runPubGetOnSdkChanges != $none) #runPubGetOnSdkChanges: runPubGetOnSdkChanges, if (updateVscodeSettings != $none) @@ -640,8 +640,8 @@ class _AppConfigCopyWithImpl<$R, $Out> useGitCache: data.get(#useGitCache, or: $value.useGitCache), gitCachePath: data.get(#gitCachePath, or: $value.gitCachePath), flutterUrl: data.get(#flutterUrl, or: $value.flutterUrl), - priviledgedAccess: - data.get(#priviledgedAccess, or: $value.priviledgedAccess), + privilegedAccess: + data.get(#privilegedAccess, or: $value.privilegedAccess), runPubGetOnSdkChanges: data.get(#runPubGetOnSdkChanges, or: $value.runPubGetOnSdkChanges), updateVscodeSettings: @@ -687,9 +687,9 @@ class ProjectConfigMapper extends ClassMapperBase { static String? _$flutterUrl(ProjectConfig v) => v.flutterUrl; static const Field _f$flutterUrl = Field('flutterUrl', _$flutterUrl, opt: true); - static bool? _$priviledgedAccess(ProjectConfig v) => v.priviledgedAccess; - static const Field _f$priviledgedAccess = - Field('priviledgedAccess', _$priviledgedAccess, opt: true); + static bool? _$privilegedAccess(ProjectConfig v) => v.privilegedAccess; + static const Field _f$privilegedAccess = + Field('privilegedAccess', _$privilegedAccess, opt: true); static bool? _$runPubGetOnSdkChanges(ProjectConfig v) => v.runPubGetOnSdkChanges; static const Field _f$runPubGetOnSdkChanges = @@ -710,7 +710,7 @@ class ProjectConfigMapper extends ClassMapperBase { #useGitCache: _f$useGitCache, #gitCachePath: _f$gitCachePath, #flutterUrl: _f$flutterUrl, - #priviledgedAccess: _f$priviledgedAccess, + #privilegedAccess: _f$privilegedAccess, #runPubGetOnSdkChanges: _f$runPubGetOnSdkChanges, #updateVscodeSettings: _f$updateVscodeSettings, #updateGitIgnore: _f$updateGitIgnore, @@ -726,7 +726,7 @@ class ProjectConfigMapper extends ClassMapperBase { useGitCache: data.dec(_f$useGitCache), gitCachePath: data.dec(_f$gitCachePath), flutterUrl: data.dec(_f$flutterUrl), - priviledgedAccess: data.dec(_f$priviledgedAccess), + privilegedAccess: data.dec(_f$privilegedAccess), runPubGetOnSdkChanges: data.dec(_f$runPubGetOnSdkChanges), updateVscodeSettings: data.dec(_f$updateVscodeSettings), updateGitIgnore: data.dec(_f$updateGitIgnore)); @@ -795,7 +795,7 @@ abstract class ProjectConfigCopyWith<$R, $In extends ProjectConfig, $Out> bool? useGitCache, String? gitCachePath, String? flutterUrl, - bool? priviledgedAccess, + bool? privilegedAccess, bool? runPubGetOnSdkChanges, bool? updateVscodeSettings, bool? updateGitIgnore}); @@ -826,7 +826,7 @@ class _ProjectConfigCopyWithImpl<$R, $Out> Object? useGitCache = $none, Object? gitCachePath = $none, Object? flutterUrl = $none, - Object? priviledgedAccess = $none, + Object? privilegedAccess = $none, Object? runPubGetOnSdkChanges = $none, Object? updateVscodeSettings = $none, Object? updateGitIgnore = $none}) => @@ -837,7 +837,7 @@ class _ProjectConfigCopyWithImpl<$R, $Out> if (useGitCache != $none) #useGitCache: useGitCache, if (gitCachePath != $none) #gitCachePath: gitCachePath, if (flutterUrl != $none) #flutterUrl: flutterUrl, - if (priviledgedAccess != $none) #priviledgedAccess: priviledgedAccess, + if (privilegedAccess != $none) #privilegedAccess: privilegedAccess, if (runPubGetOnSdkChanges != $none) #runPubGetOnSdkChanges: runPubGetOnSdkChanges, if (updateVscodeSettings != $none) @@ -852,8 +852,8 @@ class _ProjectConfigCopyWithImpl<$R, $Out> useGitCache: data.get(#useGitCache, or: $value.useGitCache), gitCachePath: data.get(#gitCachePath, or: $value.gitCachePath), flutterUrl: data.get(#flutterUrl, or: $value.flutterUrl), - priviledgedAccess: - data.get(#priviledgedAccess, or: $value.priviledgedAccess), + privilegedAccess: + data.get(#privilegedAccess, or: $value.privilegedAccess), runPubGetOnSdkChanges: data.get(#runPubGetOnSdkChanges, or: $value.runPubGetOnSdkChanges), updateVscodeSettings: diff --git a/lib/src/services/config_repository.dart b/lib/src/services/config_repository.dart index bbd29aca..48289a55 100644 --- a/lib/src/services/config_repository.dart +++ b/lib/src/services/config_repository.dart @@ -62,7 +62,7 @@ class ConfigRepository { String? flutterUrl, bool? disableUpdateCheck, DateTime? lastUpdateCheck, - bool? priviledgedAccess, + bool? privilegedAccess, bool? useGitCache, }) { final currentConfig = loadAppConfig(); @@ -73,7 +73,7 @@ class ConfigRepository { useGitCache: useGitCache, gitCachePath: gitCachePath, flutterUrl: flutterUrl, - priviledgedAccess: priviledgedAccess, + privilegedAccess: privilegedAccess, ); save(currentConfig.copyWith.$merge(newConfig)); } diff --git a/lib/src/utils/context.dart b/lib/src/utils/context.dart index 78da915e..a48221a6 100644 --- a/lib/src/utils/context.dart +++ b/lib/src/utils/context.dart @@ -162,8 +162,8 @@ class FVMContext with FVMContextMappable { /// Priviledged access @MappableField() - bool get priviledgedAccess { - return config.priviledgedAccess != null ? config.priviledgedAccess! : true; + bool get privilegedAccess { + return config.privilegedAccess != null ? config.privilegedAccess! : true; } /// Where Default Flutter SDK is stored diff --git a/lib/src/utils/context.mapper.dart b/lib/src/utils/context.mapper.dart index 03bd64b1..cd5ed2c3 100644 --- a/lib/src/utils/context.mapper.dart +++ b/lib/src/utils/context.mapper.dart @@ -66,9 +66,9 @@ class FVMContextMapper extends ClassMapperBase { static bool _$updateCheckDisabled(FVMContext v) => v.updateCheckDisabled; static const Field _f$updateCheckDisabled = Field('updateCheckDisabled', _$updateCheckDisabled); - static bool _$priviledgedAccess(FVMContext v) => v.priviledgedAccess; - static const Field _f$priviledgedAccess = - Field('priviledgedAccess', _$priviledgedAccess); + static bool _$privilegedAccess(FVMContext v) => v.privilegedAccess; + static const Field _f$privilegedAccess = + Field('privilegedAccess', _$privilegedAccess); static String _$globalCacheLink(FVMContext v) => v.globalCacheLink; static const Field _f$globalCacheLink = Field('globalCacheLink', _$globalCacheLink); @@ -101,7 +101,7 @@ class FVMContextMapper extends ClassMapperBase { #flutterUrl: _f$flutterUrl, #lastUpdateCheck: _f$lastUpdateCheck, #updateCheckDisabled: _f$updateCheckDisabled, - #priviledgedAccess: _f$priviledgedAccess, + #privilegedAccess: _f$privilegedAccess, #globalCacheLink: _f$globalCacheLink, #globalCacheBinPath: _f$globalCacheBinPath, #versionsCachePath: _f$versionsCachePath, diff --git a/lib/src/workflows/use_version.workflow.dart b/lib/src/workflows/use_version.workflow.dart index 504ffc69..540bd0aa 100644 --- a/lib/src/workflows/use_version.workflow.dart +++ b/lib/src/workflows/use_version.workflow.dart @@ -273,7 +273,7 @@ void _updateLocalSdkReference(Project project, CacheFlutterVersion version) { sdkVersionFile.file.write(project.dartToolVersion ?? ''); releaseFile.file.write(version.name); - if (!ctx.priviledgedAccess) return; + if (!ctx.privilegedAccess) return; project.localVersionsCachePath.dir ..deleteIfExists() @@ -294,7 +294,7 @@ void _updateCurrentSdkReference(Project project, CacheFlutterVersion version) { currentSdkLink.link.deleteSync(); } - if (!ctx.priviledgedAccess) return; + if (!ctx.privilegedAccess) return; currentSdkLink.link.createLink(version.directory); } @@ -367,7 +367,7 @@ void _manageVsCodeSettings(Project project) { vscodeSettingsFile.create(recursive: true); } - if (ctx.priviledgedAccess) { + if (ctx.privilegedAccess) { final relativePath = relative( project.localVersionSymlinkPath, from: project.path,