createNotification method

  1. @override
Future<Map> createNotification(
  1. String token,
  2. String deliverType,
  3. String sourceId
)
override

Implementation

@override
Future<Map> createNotification(
    String token, String deliverType, String sourceId) async {
  final String baseUrl = await getBaseUrl;
  var url = Uri.parse("$baseUrl/api/v1/notifications/create");
  var bodyData = {"deliver_type": deliverType, "source_id": sourceId};
  var jsonBody = jsonEncode(bodyData);
  var response = await http.post(
    url,
    headers: {
      "Content-Type": "application/json",
      "Authorization": "Bearer $token"
    },
    body: jsonBody,
  );
  var data = jsonDecode(response.body);
  return data;
}