Click here for details of Fam's update, Update Content.
The update method of Fam version is as follows:
- Users whose Fam version is less than 1.0.5 use
flutter pub global activate famcommand to upgrade.
- Users whose Fam version is greater than or equal to 1.0.5 use
fam --update x.x.xor
flutter pub global activate famto update.
1. Brief description
At present, for the asset management service work of Flutter project, the development tool (IDE) recommended by Flutter also provides corresponding plug-ins to handle this function; there are also some great-level developers Handwritten script or software for managing services written using Dart's automatic generation function. I have been a Flutter developer for several years, and currently I think the best project asset management service is Fam.
2. Fam service
1. Introduction to Fam
Fam is a Dart script service for Flutter project asset management service, it relies on pub.dev platform for version control. It supports a variety of platforms, simple operation, beautiful interface, easy to use and so on.
2. Fam Showcase
Asset management file under Fam service
As can be seen from the figure above, Fam divides asset files into directories, making the location of project asset files clear and easy to find.
pubspec.yaml file configuration under Fam service
As can be seen from the above figure, Fam only configures the asset file directory path in the pubspec.yaml file, avoiding the configuration of the absolute path of a large asset file.
Asset usage under Fam service
As can be seen from the above figure, Fam uses asset management class names and dot syntax to obtain asset files, which makes it easier to use asset files in projects.
Asset Usage Tips under Fam Service
As can be seen from the picture above, when Fam uses the asset management file, the prompts of the development editor can be fully read, rather than the prompts of some plug-ins are not fully read, resulting in the final choice may not necessarily be what you want asset file.
Summary: From the above, you can see some basic demonstrations of Fam. At the same time, I believe that developers also have an understanding and evaluation of various asset management plug-ins or scripts at this time.
3. Fam configuration
Fam is based on pub.dev for version management. So you can use the following command for Fam configuration. The command is as follows:
flutter pub global activate fam. If you have never configured the path of .pub-cache globally, you will be prompted to configure the path of .pub-cache/bin after running the above command. The prompts of each system are as follows:
- MacOS users
- Windows users
Windows users are advised to use the
dart pub global activate famcommand to install fam due to system differences. Because pub-cache\bin path is also deleted when deleting flutter file and using other management tools in Window system. The Pub\Cache\bin path generated by the
dart pub global activate famcommand will not be deleted.
After configuring the .pub-cache/bin path according to the above prompts, enter
fam help or
fam -h in the terminal to check whether Fam is installed successfully. Fam successful installation is displayed as follows:
If Fam installation fails, it will prompt
zsh: command not found: fam.
Four. Fam use
The Fam asset management service script provides many commands, and we will introduce them one by one below.
fam -iFunction: Perform the initial configuration of Flutter project asset management Fam service. Interaction: After the command is executed,
- Allows you to enter the file name of the project asset management, the default is fam.dart .
- Allows you to enter the class name of the project asset management, the default is FamManager .
- The naming rules of the file name are composed of lowercase letters and underscores, and the first letter cannot be an underscore, such as fam, fam_file, fam_name_file, etc.
- The naming rules of the class name are composed of uppercase letters, lowercase letters and underscores, and the first letter must be an uppercase letter, such as Fam, FamManager, Fam_Name, etc.
Effect: command execution effect
Function: When a new resource file is added to the project, use this execution order to manage the newly added assets. Effect: Execution Effect
Function: Repair the Fam configuration service of the project, for example: Fam asset management files are deleted by mistake or Fam record files are deleted by mistake, etc. Effect: command execution effect
fam filter size
Function: Check whether all asset files in the project exceed the specified size, the default is 200KB. Effect: default size instruction 200KB
Effect: specify size 10 B
You can use the
fam filter size -hcommand to get help, as follows:
You can use
fam filter size -b 10or
fam filter size -k 10or
fam filter size -m 10or
fam filter size -g 10etc.
fam filter unused
Role: Check for unused asset files in the project. Effect: command execution effect
fam filter unused --delete&
fam filter unused -d
Role: Check for unused asset files in the project and delete them at the same time.Effect: command execution effect
Role: Get fam online version and local installation version Effect: command execution effect
fam rename class Assets
Role: Rename the class name of the asset management class of Fam service. Effect: command execution effect Before change:
Management class changes after change:
Changes in where items are used after the change:
Fam's deletion service, we can use
fam delete -hto view the usage instructions:
From the above, we can know that
fam deletehas two instructions, which are
fam delete file xxsingle asset file deletion instruction and
fam delete mfile xxmultiple asset file deletion instructions.
Before deleting files:
After deleting the file:
fam delete file assets/name.webp
flutter pub global activate fam
Installation and upgrade instructions for Fam. 1: Installation see Fam configuration 2: Upgrade
5. Update Fam 1.0.5
New command added
fam --versionGet the version of Fam currently installed.
fam --releasesGet all installable stable releases of Fam.
fam --update x.x.xFam upgrades to the latest version, or you can specify a version upgrade.
6. Added support for native shader resource files
Shader file type is
The above is the basic introduction of Fam. Fam's pub.dev address is Fam address and Git address is
Fam address(https://github .com/zhoushuangjian001/fam). Welcome everyone to like and like.