123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- import 'dart:convert';
- import 'dart:core';
- import 'package:http/http.dart' as http;
- import 'package:tower_app/constants.dart';
- import 'dart:developer' as developer;
-
- class SendSurvey_Post {
- late int user_id, id, jumlah_penduduk;
- late String desa, kecamatan, kabupaten, provinsi, posisi, signal_2G, signal_3G, signal_4G, catatan;
- late List<List<dynamic>> tempat_keramaian;
- late List<List<dynamic>> foto_keterangan;
-
- SendSurvey_Post({required this.user_id});
-
- static Future<String> connectToAPI(int user_id, int id, String desa, String kecamatan, String kabupaten, String provinsi,
- int jumlah_penduduk, String posisi, String signal_2G, String signal_3G, String signal_4G, String catatan,
- List<List<dynamic>> tempat_keramaian, List<List<dynamic>> foto_keterangan) async {
- String URL = baseURL + "/api/send_survey";
-
- var sendData = await http.post(Uri.parse(URL), body: jsonEncode(
- {
- "user_id": user_id,
- "id": id,
- "desa" : desa,
- "kecamatan": kecamatan,
- "kabupaten" : kabupaten,
- "provinsi": provinsi,
- "jumlah_penduduk": jumlah_penduduk,
- "posisi": posisi,
- "signal_2G": signal_2G,
- "signal_3G": signal_3G,
- "signal_4G": signal_4G,
- "tempat_keramaian" : tempat_keramaian,
- "catatan" : catatan,
- "foto" : foto_keterangan
-
- }), headers: {
- "Content-Type": "application/json",
- "Api-key": apiKey
- });
-
- //developer.log(sendData.body, name: "GET ALL");
- return sendData.body;
- }
- }
|