36 lines
1.1 KiB
Dart
36 lines
1.1 KiB
Dart
|
import 'dart:convert';
|
||
|
import 'dart:developer';
|
||
|
import 'dart:io';
|
||
|
|
||
|
import 'package:http/http.dart' as http;
|
||
|
import 'package:unit2/model/passo/building_details.dart';
|
||
|
import 'package:unit2/model/passo/structural_materials_ii.dart';
|
||
|
import 'package:unit2/model/passo/structureMaterial.dart';
|
||
|
import 'package:unit2/utils/request.dart';
|
||
|
import 'package:unit2/utils/urls.dart';
|
||
|
|
||
|
class BuildingServices {
|
||
|
static final BuildingServices _instance = BuildingServices();
|
||
|
static BuildingServices get instance => _instance;
|
||
|
|
||
|
String xClientKey = "unitK3CQaXiWlPReDsBzmmwBZPd9Re1z";
|
||
|
String xClientKeySecret = "unitcYqAN7GGalyz";
|
||
|
|
||
|
Future<http.Response?> add(details) async {
|
||
|
String path = Url.instance.buildingDetails();
|
||
|
Map<String, String> headers = {
|
||
|
'Content-Type': 'application/json; charset=UTF-8',
|
||
|
'X-Client-Key': xClientKey,
|
||
|
'X-Client-Secret': xClientKeySecret
|
||
|
};
|
||
|
http.Response? response;
|
||
|
try {
|
||
|
response = await Request.instance
|
||
|
.postRequest(param: {}, path: path, body: details, headers: headers);
|
||
|
} catch (e) {
|
||
|
log(e.toString());
|
||
|
}
|
||
|
return response;
|
||
|
}
|
||
|
}
|