Hi there I am trying to integrate an api with flutter but a strange merged. Have an idea?
It shows link includes some '%' figure but especially it does not. Where is the problem. It is a basic think to post a request an api.
void yap ()async
{
//https://www.payfast.co.za/eng/process
//https://sandbox.payfast.co.za/eng/process
String url3 = "https://sandbox.payfast.co.za/eng/process";
//String pkistring = v1hashing(requeststr);
HttpClient httpClient = new HttpClient();
HttpClientRequest request = await httpClient.postUrl(Uri.parse(url3));
//headers
//request.headers.set('Accept' , 'application/json');
Map body = { "merchant_id" :"10000100",
"merchant_key" :"46f0cd694581a",
"amount" :"100.00",
"item_name" :"Test Product"} ;
//body
request.add(utf8.encode(json.encode(body)));
//response cevap
HttpClientResponse response = await request.close();
print(response.statusCode); // baglanti yapildi mi yapilmadi mi 200 ise yapildi
String reply = await response.transform(utf8.decoder).join();
//Map responseMap = json.decode(reply);
httpClient.close();
print("payfast ici odeme");
print(reply);
}
Error Text;
Unhandled Exception: FormatException: sandbox.payfast.co%E2%80%8B is not a valid link-local address but contains %. Scope id should be used as part of link-local address. (at character 19)
sandbox.payfast.co%E2%80%8B
^
Uri.parse(url3)intoUri.parse(url3.trim()).Uri.parse(url3)intoUri.parse(Uri.decodeFull(url))