buildBody method
Implementation
Map<String, dynamic> buildBody({
int? homeMobileCountryCode,
int? homeMobileNetworkCode,
String? radioType,
String? carrier,
bool? considerIp,
List<CellTower> cellTowers = const [],
List<WifiAccessPoint> wifiAccessPoints = const [],
}) {
var params = <String, dynamic>{};
// All optionals
if (homeMobileCountryCode != null) {
params['homeMobileCountryCode'] = homeMobileCountryCode.toString();
}
if (homeMobileNetworkCode != null) {
params['homeMobileNetworkCode'] = homeMobileNetworkCode.toString();
}
if (radioType != null) {
params['radioType'] = radioType;
}
if (carrier != null) {
params['carrier'] = carrier;
}
if (considerIp != null) {
params['considerIp'] = considerIp.toString();
}
if (cellTowers.isNotEmpty) {
params['cellTowers'] = cellTowers.map((c) => c.toJson()).toList();
}
if (wifiAccessPoints.isNotEmpty) {
params['wifiAccessPoints'] =
wifiAccessPoints.map((w) => w.toJson()).toList();
}
return params;
}