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.

getHistory_post.dart 781B

1234567891011121314151617181920212223242526272829303132
  1. import 'dart:convert';
  2. import 'dart:core';
  3. import 'package:flutter/material.dart';
  4. import 'package:http/http.dart' as http;
  5. import 'package:tower_app/constants.dart';
  6. import 'dart:developer' as developer;
  7. import 'package:shared_preferences/shared_preferences.dart';
  8. class GetHistory_Post {
  9. late int user_id;
  10. GetHistory_Post({required this.user_id});
  11. static Future<String> connectToAPI(int user_id) async {
  12. String URL = baseURL + "/api/history";
  13. var sendData = await http.post(Uri.parse(URL), body: jsonEncode({
  14. "data": [
  15. {
  16. "user_id": user_id
  17. }
  18. ]
  19. }), headers: {
  20. "Content-Type": "application/json",
  21. "Api-key": apiKey
  22. });
  23. //developer.log(sendData.body, name: "GET ALL");
  24. return sendData.body;
  25. }
  26. }