reviewStation method

Future<Response> reviewStation(
  1. String stationId,
  2. String authCode,
  3. String stars,
  4. String title,
  5. String details,
  6. String reviewPoint0,
  7. String reviewPointType0,
  8. String reviewPoint1,
  9. String reviewPointType1,
)

Implementation

Future<http.Response> reviewStation(
    String stationId,
    String authCode,
    String stars,
    String title,
    String details,
    String reviewPoint0,
    String reviewPointType0,
    String reviewPoint1,
    String reviewPointType1) async {
  var jsonBody = {
    "auth_code": authCode,
    "stars": stars,
    "title": title,
    "details": details,
    "review_points[0][review_point]": reviewPoint0,
    "review_points[0][review_point_type]": reviewPointType0,
    "review_points[1][review_point]": reviewPoint1,
    "review_points[1][review_point_type]": reviewPointType1,
  };
  //var url = Uri.parse(APIConst.STATION_REVIEW+stationId);
  //var url = Uri.https(APIConst.STATION_REVIEW, stationId);
  var url = Uri.parse('${APIConst.stationReview}/$stationId');
  Map<String, String> headers = {
    "Content-type": "application/x-www-form-urlencoded",
    'Accept': 'application/json'
  };

  //print('REQUEST ::: ' + json_body.toString());

  return await http
      .post(url, headers: headers, body: jsonBody)
      .timeout(Duration(seconds: timeOutSecond));
}