post method

Future<TransactionRequestResponse> post({
  1. required String account,
})

Implementation

Future<TransactionRequestResponse> post({required String account}) async {
  final response = await http.post(
    link,
    headers: {'Accept': 'application/json', 'Content-Type': 'application/json'},
    body: jsonEncode({'account': account}),
  );

  if (response.statusCode != 200) {
    throw HttpException(response.statusCode, response.body);
  }

  // ignore: avoid-type-casts, controlled type
  return TransactionRequestResponse.fromJson(json.decode(response.body) as Map<String, dynamic>);
}