sendTokens method Null safety

Future<PaymentResponse?> sendTokens(
  1. String recipient,
  2. int amount,
  3. {String memo = ""}
)

Creates a TX in order to deposit the amount of SNR into the recipient account. A succesful transaction will return a PaymentResponse and will return null if the transaction fails.

Example

final res = await MotorFlutter.to.deposit('did:snr:abc123', 3.29);
if (res == null) {
   throw Exception('Failed to deposit SNR');
}
print(res); // prints: {txHash: '0x1234567890abcdef', amount: 3.29}

Next Steps:

Implementation

Future<PaymentResponse?> sendTokens(String recipient, int amount, {String memo = ""}) async {
  return await MotorFlutterPlatform.instance.issuePayment(PaymentRequest(
    to: recipient,
    from: address.value,
    amount: Int64(amount),
    memo: memo,
  ));
}