有3中方式可以引入第三方的包
1、直接引用第三方插件
打开文件 pubspec.yaml,增加第三方插件barcode_scan的引用
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
#第三方插件 二维码识别
barcode_scan: ^0.0.8
运行命令 flutter packages get
android studio为例
将自行下载

2、本地引用
如果有源码,或者是本地的插件,需要在项目中增加一个目录plugins,用来存放本地从插件
dependencies:
flutter:
sdk: flutter
#本地插件
barcode_scan:
path: plugins/barcode_scan-1.0.0
注意本地插件的路径信息
3、从git中引用
fast_qr_reader_view:
git: https://github.com/facundomedica/fast_qr_reader_view.git
从github中直接引用,此处存在风险,github用户可能随时会升级版本
常用第三方插件
1、识别二维码插件 barcode_scan github
网友评论