Reputation: 83
I received the following error running flutter. The error seems to be from the package dio
Compiler message:
../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,
This is what i was trying to implement
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: "[email protected]",
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();
}
}
I was trying to implement payment in my app using flutter wave. Currently i'm using Dart 2.8.4 and Flutter 1.17.5 I already ran flutter clean but that didn't do anything would appreciate some help. Thanks
Upvotes: 1
Views: 1760
Reputation: 5601
Try changing to a newer version in the pubspec.yaml (only in GitHub's author)
flutter_rave:
git:
url: https://github.com/demimola24/flutter_rave.git
ref: master
Upvotes: 1