makeClaims static method
dynamic
makeClaims({
- required dynamic token,
- required dynamic policyId,
- required dynamic incidentDate,
- required dynamic claimDescription,
- required dynamic repairEstimate,
- required dynamic claimType,
- required dynamic claimOwner,
- required dynamic claimOwnerFirstName,
- required dynamic claimOwnerLastName,
- required dynamic claimOwnerEmail,
- required dynamic claimOwnerPhone,
- required dynamic timeStamp,
- required dynamic address,
- required dynamic lon,
- required dynamic lat,
- required File interior,
- required File dashboard,
- required File frontSide,
- required File backSide,
- required File leftSide,
- required File rightSide,
- required File chassisNumber,
- required dynamic videoUrl,
- required dynamic incidentType,
- required dynamic lostType,
- required dynamic claimInvoiceUrl,
Implementation
static makeClaims({
required token,
required policyId,
required incidentDate,
required claimDescription,
required repairEstimate,
required claimType,
required claimOwner,
required claimOwnerFirstName,
required claimOwnerLastName,
required claimOwnerEmail,
required claimOwnerPhone,
required timeStamp,
required address,
required lon,
required lat,
required File interior,
required File dashboard,
required File frontSide,
required File backSide,
required File leftSide,
required File rightSide,
required File chassisNumber,
required videoUrl,
required incidentType,
required lostType,
required claimInvoiceUrl,
}) async {
Map<String, String> headers = {
"Accept": "application/json",
"Authorization": "Bearer " + token
};
var uri = Uri.parse(ApiScheme.makeClaimsUrl);
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["policy_id"] = policyId;
request.fields["incident_date"] = incidentDate;
request.fields["claim_description"] = claimDescription;
request.fields["repair_estimate"] = repairEstimate;
request.fields["claim_type"] = claimType == 'Auto' ? 'vehicle' : 'gadget';
request.fields["claim_owner"] = claimOwner;
request.fields["claim_invoice_url"] = claimInvoiceUrl;
request.fields["claim_owner_first_name"] = claimOwnerFirstName;
request.fields["claim_owner_last_name"] = claimOwnerLastName;
request.fields["claim_owner_email"] = claimOwnerEmail;
request.fields["claim_owner_phone_number"] = claimOwnerPhone;
request.fields["incident_type"] = incidentType;
request.fields["loss_type"] = lostType;
request.fields['timestamp'] = timeStamp;
request.fields['address'] = address;
request.fields['video_url'] = videoUrl;
request.fields['longitude'] = lon.toString();
request.fields['latitude'] = lat.toString();
var response = await request.send();
return response;
}