name: flutter_app
description: A new Flutter application.
publish_to: 'none'
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.0
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
name
import 'package:flutter_app/home_page.dart';
import 'package:flutter_app_demo/home_page.dart';
description
version
path_provider: ^1.6.22
不指定或者 any
path_provider:
path_provider: any
x.y.z
path_provider: 1.6.22
<=x.y.z 或者<x.y.z
path_provider: <=1.6.22
path_provider: <1.6.22
>=a.b.c <x.y.z
path_provider: '>=1.0.0 <1.6.22'
^x.y.z
path_provider: ^1.6.22
author homepage issue_tracker repository
- author:作者,填写自己的署名
- homepage:主页。
- issue_tracker:issue,一般写当前插件源代码的Github issue 地址。
- repository:一般写当前插件源代码的Github地址。
Environment
environment:
sdk: ">=2.7.0 <3.0.0"
environment:
sdk: ">=2.7.0 <3.0.0"
flutter: "1.22.0"
environment:
sdk: ">=2.11.0-213.0.dev <2.12.0"
dependencies 和 dev_dependencies
- 依赖 pub.dev 上的第三方库
- 依赖本地库
- 依赖 git repository
- 依赖我们自己的 pub仓库
依赖 pub.dev 上的第三方库
dependencies:
path_provider: ^1.6.22
依赖本地库
dependencies:
flutter_package:
path: ../flutter_package
依赖 git repository
dependencies:
bloc:
git:
url: https://github.com/felangel/bloc.git
ref: bloc_fixes_issue_110
path: packages/bloc
- url:github 地址
- ref:表示git引用,可以是 commit hash,tag 或者 branch
- path:如果 git 仓库中有多个软件包,则可以使用此属性指定软件包
依赖我们自己的 pub 仓库。
dependencies:
bloc:
hosted:
name: bloc
url: http://your-package-server.com
version: ^6.0.0
依赖覆盖
Running "flutter pub get" in flutter_app...
Because every version of flutter_plugin from path depends on path_provider ^0.5.0 and flutter_app depends on path_provider ^1.6.22,flutter_plugin from path is forbidden.
So,because flutter_app depends on flutter_plugin from path,version solving failed.
pub get failed (1; So,version solving failed.)
Process finished with exit code 1
dependency_overrides:
path_provider: ^1.6.22
/Users/mengqingdong/project/flutter/bin/flutter --no-color pub get
Running "flutter pub get" in flutter_app...
Warning: You are using these overridden dependencies:
! path_provider 1.6.22
Running "flutter pub get" in flutter_app... 0.5s
Process finished with exit code 0
Flutter
uses-material-design
flutter:
uses-material-design: true
assets
assets:
- images/a_dot_burr.jpeg
- images/a_dot_ham.jpeg
fonts:
- family: Schyler
fonts:
- asset: fonts/Schyler-Regular.ttf
- asset: fonts/Schyler-Italic.ttf
style: italic
- family: Trajan Pro
fonts:
- asset: fonts/TrajanPro.ttf
- asset: fonts/TrajanPro_Bold.ttf
weight: 700
plugin
flutter:
plugin:
platforms:
android:
package: com.flutter.app_market
pluginClass: AppMarketPlugin
ios:
pluginClass: AppMarketPlugin
flutter:
plugin:
platforms:
android:
package: com.flutter.app_market
pluginClass: AppMarketPlugin
ios:
pluginClass: AppMarketPlugin
macos:
default_package: app_market_macos
web:
default_package: app_market_web