我正在开发一个flutter应用程序。我想添加两种不同的风格,以分离出一些特定于风格的功能。我已经遵循了this文档。这里是我的pubspec.yaml文件。
name: flutter_app
version: 1.0.20+20
environment:
sdk: ">=2.3.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
provider: ^4.0.1
cupertino_icons: ^0.1.2
intl: ^0.16.0
shared_preferences:
http: ^0.12.0+4
sqflite: ^1.2.0
path_provider:
permission_handler: ^4.1.0
package_info: ^0.4.0+18
flutter_localizations:
sdk: flutter
#flutter_local_notifications: ^0.7.1+1
#firebase_messaging: ^5.0.1+1
#fluttertoast: ^3.1.0
dev_dependencies:
flutter_test:
sdk: flutter
flutter_flavorizr: ^1.0.7
flavorizr:
app:
android:
flavorDimensions: "flavor-type"
ios:
flavors:
mainapp:
app:
name: "Main App"
android:
applicationId: "com.example.app1"
ios:
bundleId: "com.example.app1"
banana:
master:
name: "App Master"
android:
applicationId: "com.example.app2"
ios:
bundleId: "com.example.app2"
flutter:
uses-material-design: true
assets:
- assets/
- assets/fonts/
- assets/drawables/
- assets/icon/
- assets/lang/en.json
- assets/lang/de.json
- assets/lang/de-DE.json
- assets/lang/de-CH.json
- assets/lang/de-AT.json
- assets/lang/en-IN.json
fonts:
- family: Poppins-Bold
fonts:
- asset: assets/fonts/Poppins-Bold.ttf
- family: Poppins-Medium
fonts:
- asset: assets/fonts/Poppins-Medium.ttf
字符串
在运行flutter pub run flutter_flavorizr后,我得到以下错误。
The following fields were missing: [app]. Read the docs for further details
Unhandled exception:
NoSuchMethodError: The getter 'flavorizr' was called on null.
Receiver: null
Tried calling: flavorizr
Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)
Processor._initAvailableProcessors (package:flutter_flavorizr/processors/processor.dart:110:18)
new Processor (package:flutter_flavorizr/processors/processor.dart:88:5)
execute (package:flutter_flavorizr/flutter_flavorizr.dart:52:25)
main (file:///D:/Users/Dhaval/Flutter/.pub-cache/hosted/pub.dartlang.org/flutter_flavorizr-1.0.7/bin/flutter_flavorizr.dart:4:3)
_startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:299:32)
_RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)
pub finished with exit code 255
型
我错过了什么吗?我如何解决这个问题?任何帮助都表示感谢。谢谢。
2条答案
按热度按时间kmpatx3s1#
我有同样的问题.张贴它的情况下,这有助于别人.我花了相当多的时间环顾四周.错误消息是通用和神秘,我找不到任何线索.
所以我检查了他们的代码。事实证明,错误消息与问题无关。当我的pubscpec.yaml中的flavorizer块不正确时,会抛出此错误。一旦我检查了该部分并纠正了错误,命令就工作了。
arknldoa2#
在我的pubspec.yaml文件中,flavorizr开始时有以下配置
字符串
我把线拿掉了
型
错误就消失了