import 'dart:convert'; import 'package:http/http.dart'; import '../../../Helper/Logger.dart'; import '../../../Model/Request/Notification/Notification_request_rider.dart'; import '../../../Model/Request/Notification/Notificationrequest.dart'; import '../../../Model/Response/Authentication/Sms/Smsresponse.dart'; import '../../../Model/Response/Notification/Notificationresponse.dart'; class NotificationProvider{ Future createNotification(NotificationRequest data,String urldata,) async { NotificationResponse? notificationResponse; try { final url = Uri.parse(urldata); final response = await post(url, body: json.encode(data), headers: { 'Content-Type': 'application/json', 'Accept': 'application/json', // 'Authorization': '$token', }); logger.i(json.encode(data.toJson())); print('notificationResponsebody ${response.body}'); print('notificationdatatoJson ${data.toJson()}'); print('CreateNotificationurlsssssssssss ${urldata.toString()}'); Map parsedJson = json.decode(response.body.toString()); notificationResponse = NotificationResponse.fromJson(parsedJson); print('createOrderinprovider ${notificationResponse.toJson()}'); } catch (e) { print(e.toString()); print("error"); } return notificationResponse; } Future NotifyRider(RiderNotificationRequest data,String urldata,) async { NotificationResponse? notificationResponse; try { final url = Uri.parse(urldata); final response = await post(url, body: json.encode(data), headers: { 'Content-Type': 'application/json', 'Accept': 'application/json', // 'Authorization': '$token', }); logger.i(json.encode(data.toJson())); print('notificationResponsebody ${response.body}'); print('notificationdatatoJson ${data.toJson()}'); print('CreateNotificationurlsssssssssss ${urldata.toString()}'); Map parsedJson = json.decode(response.body.toString()); notificationResponse = NotificationResponse.fromJson(parsedJson); print('createOrderinprovider ${notificationResponse.toJson()}'); } catch (e) { print(e.toString()); print("error"); } return notificationResponse; } }