简体   繁体   English

Flutter - 连通性 package

[英]Flutter - connectivity package

How should I add this package to pubspec?我应该如何将这个 package 添加到 pubspec? Thank you!谢谢! 在此处输入图像描述

This is the simplest way to install any package这是安装任何 package 的最简单方法

  1. Search and open package page on https://pub.dev/https://pub.dev/上搜索并打开 package 页面
  2. Click on the Installing tab单击Installing选项卡
  3. Copy the line and add to pubspec.yaml复制该行并添加到pubspec.yaml

So in your case go to https://pub.dev/packages/connectivity/install and paste the code.所以在你的情况下 go 到https://pub.dev/packages/connectivity/install并粘贴代码。

Currently it is connectivity: ^0.4.9 .目前是connectivity: ^0.4.9 Use 2 spaces for indentation.使用 2 个空格进行缩进。


In general一般来说

Given a version number MAJOR.MINOR.PATCH , increment the:给定版本号MAJOR.MINOR.PATCH ,递增:

MAJOR version when you make incompatible API changes,进行不兼容的 API 更改时的MAJOR版本,

MINOR version when you add functionality in a backwards compatible manner, and以向后兼容的方式添加功能时的MINOR版本,以及

PATCH version when you make backwards compatible bug fixes.进行向后兼容的错误修复时的PATCH版本。

so, increase PATCH for bug fixes.因此,增加 PATCH 以修复错误。 increase MINOR for new features without breaking old code increase MAJOR when using it will break old code.在不破坏旧代码的情况下为新功能增加 MINOR 在使用时增加 MAJOR 会破坏旧代码。

Add this to your package's pubspec.yaml file:将此添加到您的包的 pubspec.yaml 文件中:

connectivity: ^0.4.9

If you want to add constraints, replace the x and y with the lowest version you want, such as 0.4.8+6.如果要添加约束,请将 x 和 y 替换为您想要的最低版本,例如 0.4.8+6。 See the plugin's pub.dev page for more versions.有关更多版本,请参阅插件的 pub.dev 页面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM