gpt4 book ai didi

flutter - 我的Flutter项目未运行(错误消息)

转载 作者:行者123 更新时间:2023-12-03 04:43:21 24 4
gpt4 key购买 nike

我收到了以下有关运行抖动的错误。
错误似乎来自软件包dio
编译器消息:

../flutter/.pub-cache/hosted/pub.dartlang.org/dio-2.2.2/lib/src/dio_http_headers.dart:55:8: Error: The method 'DioHttpHeaders.add' has fewer named
arguments than those of overridden method 'HttpHeaders.add'.
void add(String name, value) {
^
org-dartlang-sdk:///third_party/dart/sdk/lib/_http/http.dart:694:8: Context: This is the overridden method ('add').
void add(String name, Object value,
^
../flutter/.pub-cache/hosted/pub.dartlang.org/dio-2.2.2/lib/src/dio_http_headers.dart:70:8: Error: The method 'DioHttpHeaders.set' has fewer named
arguments than those of overridden method 'HttpHeaders.set'.
void set(String name, Object value) {
^
org-dartlang-sdk:///third_party/dart/sdk/lib/_http/http.dart:703:8: Context: This is the overridden method ('set').
void set(String name, Object value,
这就是我试图实现的
import 'package:flutter/material.dart';
import 'package:flutter_rave/flutter_rave.dart';

class DepositPage extends StatefulWidget {
DepositPage({Key key}) : super(key: key);
@override
_DepositPageState createState() => _DepositPageState();
}

class _DepositPageState extends State<DepositPage> {
@override
Widget build(BuildContext context) {
return Center(
child: Builder(
builder: (context) => SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.only(left: 10.0, right: 10),
child: InkWell(
onTap: () => _pay(context),
child: Card(
color: Colors.orangeAccent,
elevation: 15,
child: Container(
height: 250,
width: MediaQuery.of(context).size.width,
child: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
"Card Payment",
style: TextStyle(
color: Colors.black,
fontSize: 20,
fontWeight: FontWeight.bold),
),
SizedBox(
width: 10,
),
Icon(
Icons.payment,
color: Colors.black,
size: 30,
)
],
),
),
),
),
),
),
),
));
}

_pay(BuildContext context) {
final snackBar_onFailure = SnackBar(content: Text('Transaction failed'));
final snackBar_onClosed = SnackBar(content: Text('Transaction closed'));
final _rave = RaveCardPayment(
isDemo: true,
encKey: "i have to hide this",
publicKey: "i have to hide this too",
transactionRef: "This as well",
amount: 100,
email: "demo1@example.com",
onSuccess: (response) {
print("$response");
print("Transaction Successful");
if (mounted) {
Scaffold.of(context).showSnackBar(
SnackBar(
content: Text("Transaction Sucessful!"),
backgroundColor: Colors.green,
duration: Duration(
seconds: 5,
),
),
);
}
},
onFailure: (err) {
print("$err");
print("Transaction failed");
Scaffold.of(context).showSnackBar(snackBar_onFailure);
},
onClosed: () {
print("Transaction closed");
Scaffold.of(context).showSnackBar(snackBar_onClosed);
},
context: context,
);
_rave.process();
}
}
我试图使用波动来在我的应用程序中实现付款。
目前我正在使用Dart 2.8.4和Flutter 1.17.5
我已经拍干净了,但是什么也没做
将不胜感激。谢谢

最佳答案

尝试在pubspec.yaml中更改为较新的版本(仅在GitHub的作者中)

flutter_rave:
git:
url: https://github.com/demimola24/flutter_rave.git
ref: master

关于flutter - 我的Flutter项目未运行(错误消息),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62736529/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com