当前位置:网站首页>Dart series: metaworld pubspec Yaml file details
Dart series: metaworld pubspec Yaml file details
2022-06-24 01:20:00 【Procedural stuff】
brief introduction
pubspec.yaml It's all dart The soul of the project , It contains all dart Project dependency information and other meta information , therefore pubspec.yaml Namely dart Project meta!
pubspec.yaml Supported fields
according to dart The definition of ,pubspec.yaml You can include the following fields :
Field name | Is a field required | describe |
|---|---|---|
name | yes | package Name |
version | If released to pub.dev, You need to | package Version number of |
description | If released to pub.dev, You need to | package Description information of |
homepage | no | package The home page of |
repository | no | package Source code address of |
issue_tracker | no | package Problem tracking address |
documentation | no | package Documentation information for |
dependencies | no | package Of information |
dev_dependencies | no | pacakge Of dev Dependent information |
dependency_overrides | no | What do you want to cover package |
environment | dart2 need | |
executables | no | package The executable path of |
publish_to | no | package How to publish |
Be careful , Above is dart in pubspec.yaml Supported fields , If it's in flutter Environment , There will be some additional supported fields .
# An example
Let's take a concrete example :
name: my_app version: 11.15 description: >- this is a new app homepage: http://www.flydean.com documentation: http://www.flydean.com environment: sdk: '>=2.10.0 <3.0.0' dependencies: efts: ^2.0.4 transmogrify: ^0.4.0 dev_dependencies: test: '>=1.15.0 <2.0.0'
Field details
Let's take a look at the details and restrictions of each field :
- Name
name Indicates the name of the package ,name It must be all lowercase , If there are more than one word , Underline can be used to distinguish , Such as :my_app.
And can only use a combination of lowercase letters and numbers , And it can't start with a number , And don't use dart Reserved word in .
- Version
Version It means the version number , The version number is three numbers separated by dots , Such as :11.15.0. You can keep up with build Version number :+1, +2, +hotfix.oopsie, Or pre release version, etc :-dev.4, -alpha.12, -beta.7, -rc.5.
- Description
package It is best to use English to describe , The length is 60 To 180 Characters , Indicates the function of this package .
- Dependencies
There are two kinds of dependent information , One is that all use this packages All people need to rely on , This dependence is placed on dependencies in .
Another is only used in the current pacakge Package under development , This dependence is placed on dev_dependencies in .
In some cases , We may need to override some dependent packages , Can be placed in :dependency_overrides in .
- Executables
There are some pacakges Tools are provided for everyone to use , These tools may be command line tools , So you need to be in executables Specifies the path of the command that can be executed .
For example, the following configuration :
executables: slidy: main fvm:
Then in execution pub global activate after , You can execute... Globally slidy To execute bin/main.dart, and fvm To execute binfvm.dart.
- environment
because Dart It's a new language , So at present, the change is still very big . So some applications can depend on different dart edition , And that's where it comes in environment:
environment: sdk: '>=2.10.0 <3.0.0'
In the above code , We have designated dart sdk Version range of .
from dart1.19 after ,environment: Specifying... Is also supported in flutter Version of :
environment: sdk: '>=1.19.0 <3.0.0' flutter: ^0.1.2
summary
That's all dart Meta world of pubspec.yaml Detailed explanation .
This article has been included in http://www.flydean.com/10-dart-pubspec/
边栏推荐
- How to view kubernetes API traffic by grabbing packets
- 【Flutter】如何使用Flutter包和插件
- How to build a "preemptive" remote control system (- - memory chapter)
- Salesforce batch apex batch processing (I)
- [applet] when compiling the preview applet, a -80063 error prompt appears
- [technology planting grass] skillfully use cloud function to create wechat web page authorization public service
- DML operation
- Dart series: creating a library package
- Millions of routers are at risk of attack, and hackers supported by North Korea are invading the United States and Britain | November 19 global network security hotspot
- Why traifik ingress?
猜你喜欢

这不会又是一个Go的BUG吧?

GNN upper edge distributor! Instead of trying to refine pills, you might as well give your GNN some tricks

实时计算框架:Spark集群搭建与入门案例

Niu Xuechang's anniversary celebration: software promotion, limited time and free registration code!

Installation and use of winscp and putty

WinSCP和PuTTY的安装和使用

Apple iphone14 is equipped with Beidou navigation system. What are the advantages of Beidou vs GPS?

JS input / output statements, variables

Everything I see is the category of my precise positioning! Open source of a new method for saliency map visualization

GNN上分利器!与其绞尽脑汁炼丹,不如给你的GNN撒点trick吧
随机推荐
Cross domain and jsonp
version `ZLIB_ 1.2.9‘ not found (required by /lib64/libpng16.so.16)
Apple iphone14 is equipped with Beidou navigation system. What are the advantages of Beidou vs GPS?
Theoretical analysis of countermeasure training: adaptive step size fast countermeasure training
Open source model library of flying propeller industry: accelerating the development and application of enterprise AI tasks
[technical grass planting] deploy a super large capacity and unlimited speed network disk in Tencent cloud
Perhaps the greatest romance of programmers is to commemorate their dead mother with a software
CDN access log quality performance monitoring and operation statistical analysis best practices
Force buckle deletes duplicates in the sort array
【小程序】编译预览小程序时,出现-80063错误提示
One article introduces you to the world of kubernetes
Real time computing framework: Spark cluster setup and introduction case
4 most common automated test challenges and Countermeasures
November 20, 2021: the start and end times of a movie can be listed in a small array
Leetcode lecture on algorithm interview for large factories 2 Time space complexity
[applet] when compiling the preview applet, a -80063 error prompt appears
[ICPR 2021] tiny object detection in aerial images
Solve the problem that Base64 compressed files are extracted with spaces after post request
LSF opens job idle information to view the CPU time/elapse time usage of the job
Use recursion to form a multi-level directory tree structure, with possibly the most detailed notes of the whole network.