No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

sendSurvey_post.dart 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import 'dart:convert';
  2. import 'dart:core';
  3. import 'package:http/http.dart' as http;
  4. import 'package:tower_app/constants.dart';
  5. import 'dart:developer' as developer;
  6. class SendSurvey_Post {
  7. late int user_id, id, jumlah_penduduk;
  8. late String desa, kecamatan, kabupaten, provinsi, posisi, signal_2G, signal_3G, signal_4G, catatan;
  9. late List<List<dynamic>> tempat_keramaian;
  10. late List<List<dynamic>> foto_keterangan;
  11. SendSurvey_Post({required this.user_id});
  12. static Future<String> connectToAPI(int user_id, int id, String desa, String kecamatan, String kabupaten, String provinsi,
  13. int jumlah_penduduk, String posisi, String signal_2G, String signal_3G, String signal_4G, String catatan,
  14. List<List<dynamic>> tempat_keramaian, List<List<dynamic>> foto_keterangan) async {
  15. String URL = baseURL + "/api/send_survey";
  16. var sendData = await http.post(Uri.parse(URL), body: jsonEncode(
  17. {
  18. "user_id": user_id,
  19. "id": id,
  20. "desa" : desa,
  21. "kecamatan": kecamatan,
  22. "kabupaten" : kabupaten,
  23. "provinsi": provinsi,
  24. "jumlah_penduduk": jumlah_penduduk,
  25. "posisi": posisi,
  26. "signal_2G": signal_2G,
  27. "signal_3G": signal_3G,
  28. "signal_4G": signal_4G,
  29. "tempat_keramaian" : tempat_keramaian,
  30. "catatan" : catatan,
  31. "foto" : foto_keterangan
  32. }), headers: {
  33. "Content-Type": "application/json",
  34. "Api-key": apiKey
  35. });
  36. //developer.log(sendData.body, name: "GET ALL");
  37. return sendData.body;
  38. }
  39. }