cake_wallet/lib/utils/payment_request.dart
OmarHatem f078457c7b Update Branch to null safety
Add deep linking to iOS
2022-11-08 16:56:27 +02:00

25 lines
No EOL
650 B
Dart

class PaymentRequest {
PaymentRequest(this.address, this.amount, this.note, this.scheme);
factory PaymentRequest.fromUri(Uri? uri) {
var address = "";
var amount = "";
var note = "";
var scheme = "";
if (uri != null) {
address = uri.path;
amount = uri.queryParameters['tx_amount'] ?? uri.queryParameters['amount'] ?? "";
note = uri.queryParameters['tx_description']
?? uri.queryParameters['message'] ?? "";
scheme = uri.scheme;
}
return PaymentRequest(address, amount, note, scheme);
}
final String address;
final String amount;
final String note;
final String scheme;
}