putJsonData method
دالة خاصة لتعديل البيانات بالقاموس الذي تم تمريره مع الدالة
data
=>(قاموس)
inspect
=> (،ارجاع القيمة المراد استخدامها ,json التنقيب داخل )
Implementation
Future putJsonData(int id, String endpoint, Map<String, dynamic> data,
{Function(dynamic data)? inspect,
Function(Object error) onError = _onError}) async {
Uri url = Uri.parse(this.url + "/" + endpoint + "/" + id.toString() + "/");
try {
http.Response response =
await http.put(url, body: json.encode(data), headers: headers);
return _jsonData(response, inspect: inspect, endpoint: endpoint);
} catch (e) {
onError(e);
}
}