fam 1.1.4 fam: ^1.1.4 copied to clipboard
Fam is a scripting service for flutter project asset management.
πΊπΈ English | π¨π³ Chinese
1.1.3
Click here( Update Content ) for details of fam's update.
1.1.2
The update method of fam version is as follows:
- Users whose fam version is less than 1.0.5 use
flutter pub global activate fam
command to upgrade. - Users whose fam version is greater than or equal to 1.0.5 use
fam --update
orfam --update x.x.x
orflutter pub global activate fam
to update.
1. Introduction #
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
Note:
Windows users are advised to use the
dart pub global activate fam
command 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 thedart pub global activate fam
command 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
.
4. Fam Use #
The fam asset management service script provides many commands, and we will introduce them one by one below.
-
fam init
&fam -i
Function: 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 .
Note:
-
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: Execution effect
-
-
fam run
&fam -r
Function : When a new resource file is added to the project, use this execution order to manage the newly added assets.
Effect: Execution Effect
-
fam fix
&fam -fi
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: 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 -h
command to get help, as follows:You can use
fam filter size -b 10
orfam filter size -k 10
orfam filter size -m 10
orfam filter size -g 10
etc. -
fam filter unused
Role : Check for unused asset files in the project.
Effect: 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: Execution effect
-
fam release
&fam version
Role : Get fam online version and local installation version
Effect: Execution effect
-
fam rename class Assets
Role : Rename the class name of the asset management class of Fam service.
Effect: Execution effect
-
Before change:
-
Management class changes after change:
Changes in where items are used after the change:
-
-
fam delete
fam's deletion service, we can use
fam delete -h
to view the usage instructions:From the above, we can know that
fam delete
has two instructions, which arefam delete file xx
single asset file deletion instruction andfam delete mfile xx
multiple 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.
-
Installation see fam configuration
-
Upgrade
-
5. Update Fam 1.0.5 #
New command added:
-
fam --version
Get the version of Fam currently installed.
-
fam --releases
Get all installable stable releases of Fam.
-
fam --update
&fam --update x.x.x
Fam upgrades to the latest version, or you can specify a version upgrade.
6. Added support for native shader resource files #
Shader file type is .frag
.
7. Added support for some file types #
Compressed file type: .zip
And .rar
; Font type: .ttf
.
8. Summary #
The above is the basic introduction of Fam. Fam's pub.dev address is Fam address and Git address is Fam address. Welcome everyone to like and like.