From e7fc05e0869c93a51bc8a3a68b4ba9aa0f58d938 Mon Sep 17 00:00:00 2001 From: Leo Farias Date: Wed, 28 Feb 2024 11:16:49 -0500 Subject: [PATCH] Update docs --- .../getting-started/configuration.mdx | 114 ++++++++---------- lib/src/services/logger_service.dart | 5 +- 2 files changed, 53 insertions(+), 66 deletions(-) diff --git a/docs/pages/documentation/getting-started/configuration.mdx b/docs/pages/documentation/getting-started/configuration.mdx index a2a3cd3b..dae02724 100644 --- a/docs/pages/documentation/getting-started/configuration.mdx +++ b/docs/pages/documentation/getting-started/configuration.mdx @@ -11,74 +11,60 @@ Configure FVM and IDEs for better support for different development environments ## Project -FVM will create a relative symlink in your project from `.fvm/flutter_sdk` to the cache of the selected version. Add it to your `.gitignore` - -```title=".gitignore" -.fvm/flutter_sdk -``` - -## FVM - -### Cache Directory - -You can configure the **fvm** cache directory by setting `FVM_HOME` environment variable. If nothing is set the default **fvm** path will be used. You are also able to change the directory by setting the `--cache-path` on the config. See below - -### Config - -There are some configurations which you can change on FVM. **All settings set on CLI are compatible with the Sidekick(GUI)**. - -### Different Flutter Repo - -You can use a different Flutter repo, a fork or as a local cache, by setting the `FVM_GIT_CACHE` environment variable. - -#### List config - -```bash -> fvm config -``` - -#### Set cache path - -Location where Flutter SDK versions will be stored. If nothing is set, the default will be used. - -```bash -> fvm config --cache-path +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. + +```json +{ + "flutter": "3.19.1", + "flavors": { + "development": "beta", + "production": "3.19.1" + }, + "updateVscodeSettings": true, + "updateGitIgnore": true, + "runPubGetOnSdkChanges": true +} ``` -## IDE - - - You might have to restart your IDE and the Flutter debugger to make sure it - uses the latest version of the configurations in some situations. +- `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. +- `flutterSdkVersion`: The version of the Flutter SDK to be used, falling back to the flutter value if not explicitly set. +- `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: + +- **flutter_sdk** - Symlink to the Flutter SDK version linked to the project. +- **versions/{version}** - 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. + + + Starting 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`. -### Android Studio - -1. Go to `Languages & Frameworks > Flutter` or search for Flutter and change Flutter SDK path. -2. Copy the **_absolute_** path of fvm symbolic link in your root project directory. Example: `/absolute-project-path/.fvm/flutter_sdk` -3. Apply the changes. -4. Restart Android Studio to see the new settings applied. - - -For Android Studio to detect the dynamic change of SDKs, the installed SDK must have finished setup. +## Envioronment Variables -Using `fvm install ` will ensure that setup during install. +Set environment variables at the system level to apply configurations globally. These are typically used for settings that remain constant across multiple projects or runtime environments. -If you have installed through another command and setup was not completed. You can finish by just running `fvm flutter --version` - -Android Studio might take a few seconds to detect the dynamic SDK change. - - - -If you want to ignore the Flutter SDK root directory within Android Studio you can add the following to `.idea/workspace.xml`. - -```xml - - - - - -... -``` +## Supported Environment Variables: -If that doesn't work, go to Android Studio -> Preferences -> Editor -> File Types -> Ignored Files and Folders and add `flutter_sdk`: +- `FVM_CACHE_PATH`: Specifies the cache path for Flutter versions. +- `FVM_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`). diff --git a/lib/src/services/logger_service.dart b/lib/src/services/logger_service.dart index 0da730d9..967ae2c8 100644 --- a/lib/src/services/logger_service.dart +++ b/lib/src/services/logger_service.dart @@ -1,12 +1,13 @@ import 'dart:async'; import 'package:dart_console/dart_console.dart'; -import 'base_service.dart'; -import '../utils/context.dart'; import 'package:interact/interact.dart' as interact; import 'package:mason_logger/mason_logger.dart'; import 'package:tint/tint.dart'; +import '../utils/context.dart'; +import 'base_service.dart'; + /// Sets default logger mode LoggerService get logger => getProvider();