inspection static method
dynamic
inspection({
- dynamic token,
- dynamic customerId,
- dynamic policyId,
- dynamic providerId,
- dynamic distributorId,
- dynamic timeStamp,
- required File interior,
- required File dashboard,
- required File frontSide,
- required File backSide,
- required File leftSide,
- required File rightSide,
- required File chassisNumber,
- dynamic address,
- dynamic lon,
- dynamic lat,
- dynamic inspectionType,
- dynamic videoUrl,
Implementation
static inspection(
{token,
customerId,
policyId,
providerId,
distributorId,
timeStamp,
required File interior,
required File dashboard,
required File frontSide,
required File backSide,
required File leftSide,
required File rightSide,
required File chassisNumber,
address,
lon,
lat,
inspectionType,
videoUrl}) async {
Map<String, String> headers = {
"Accept": "application/json",
"Authorization": "Bearer " + token
};
var uri = Uri.parse(ApiScheme.submitInspectionUrl);
var request = http.MultipartRequest("POST", uri);
request.files
.add(await http.MultipartFile.fromPath('interior', interior.path));
request.files
.add(await http.MultipartFile.fromPath('front_side', frontSide.path));
request.files
.add(await http.MultipartFile.fromPath('back_side', backSide.path));
request.files
.add(await http.MultipartFile.fromPath('left_side', leftSide.path));
request.files
.add(await http.MultipartFile.fromPath('right_side', rightSide.path));
request.files
.add(await http.MultipartFile.fromPath('dashboard', dashboard.path));
request.files.add(
await http.MultipartFile.fromPath('chasis_number', chassisNumber.path));
request.headers.addAll(headers);
request.fields['customer_id'] = customerId;
request.fields['policy_id'] = policyId;
request.fields['provider_id'] = providerId;
request.fields['distributor_id'] = distributorId;
request.fields['inspection_type'] = inspectionType;
request.fields['timestamp'] = timeStamp;
request.fields['address'] = address ?? 'hehhe';
request.fields['video_url'] = videoUrl;
request.fields['longitude'] = lon.toString();
request.fields['latitude'] = lat.toString();
var response = await request.send();
print(response.statusCode);
print(response.reasonPhrase);
return response;
}