addReport method

Future<ReportModel?> addReport(
  1. dynamic typeId,
  2. dynamic userId,
  3. dynamic postId
)

Implementation

Future<ReportModel?> addReport(typeId, userId, postId) {
  Log(
    logName: 'AddReport',
    className: 'Report',
    methodName: 'addReport',
    type: 'INFO',
    text:
        '{event: Add Report, user: ${currentUser?.userPayloadId}, user is ${currentUser?.firstName} ${currentUser?.lastName}, user id: $userId, post id: $postId, type id: $typeId',
  );
  return _httpService
      .addReport(typeId: typeId, userId: userId, postId: postId)
      .then((data) async {
    if (data.statusCode >= 200 && data.statusCode < 300) {
      var res = json.decode(data.body);
      ReportModel reportData = ReportModel.fromJson(res[0]);
      return reportData;
    }
    return null;
  });
}