updateLocation method
Update location
Implementation
Future<Location> updateLocation(
String locationId, {
String? name,
String? code,
String? description,
String? type,
String? status,
String? parentId,
Address? address,
ContactInfo? contactInfo,
Map<String, dynamic>? metadata,
}) async {
final data = <String, dynamic>{};
if (name != null) data['name'] = name;
if (code != null) data['code'] = code;
if (description != null) data['description'] = description;
if (type != null) data['type'] = type;
if (status != null) data['status'] = status;
if (parentId != null) data['parentId'] = parentId;
if (address != null) data['address'] = address.toJson();
if (contactInfo != null) data['contactInfo'] = contactInfo.toJson();
if (metadata != null) data['metadata'] = metadata;
final response = await _apiClient.put<Map<String, dynamic>>(
'/api/v1/locations/$locationId',
data: data,
);
final responseData = response['data'] as Map<String, dynamic>;
return Location.fromJson(responseData);
}