toMap method
Implementation
Map<String, dynamic> toMap() {
final optionsMap = <String, dynamic>{};
void addIfNonNull(String fieldName, dynamic value) {
if (value != null) {
optionsMap[fieldName] = value;
}
}
addIfNonNull('apikey', apiKey);
addIfNonNull('mapStyle', mapStyle);
addIfNonNull('initialLatitude', initialLatitude);
addIfNonNull('initialLongitude', initialLongitude);
addIfNonNull('trackCameraPosition', trackCameraPosition);
addIfNonNull('language', language);
addIfNonNull('animateBuildRoute', animateBuildRoute);
addIfNonNull('longPressDestinationEnabled', longPressDestinationEnabled);
if (customLocationCenterIcon != null) {
optionsMap['customLocationCenterIcon'] = customLocationCenterIcon;
}
if (zoom != null) optionsMap['zoom'] = zoom;
if (bearing != null) optionsMap['bearing'] = bearing;
if (tilt != null) optionsMap['tilt'] = tilt;
if (alternatives != null) {
optionsMap['alternatives'] = alternatives;
}
if (mode != null) {
optionsMap['mode'] = mode?.toString().split('.').last;
}
if (units != null) {
optionsMap['units'] = units?.toString().split('.').last;
}
if (allowsUTurnAtWayPoints != null) {
optionsMap['allowsUTurnAtWayPoints'] = allowsUTurnAtWayPoints;
}
if (enableRefresh != null) {
optionsMap['enableRefresh'] = enableRefresh;
}
addIfNonNull('voiceInstructionsEnabled', voiceInstructionsEnabled);
addIfNonNull('bannerInstructionsEnabled', bannerInstructionsEnabled);
if (mapStyleUrlDay != null) {
optionsMap['mapStyleUrlDay'] = mapStyleUrlDay;
}
if (mapStyleUrlNight != null) {
optionsMap['mapStyleUrlNight'] = mapStyleUrlNight;
}
if (simulateRoute != null) {
optionsMap['simulateRoute'] = simulateRoute;
}
if (isOptimized != null) optionsMap['isOptimized'] = isOptimized;
addIfNonNull('padding', <double?>[
padding?.top,
padding?.left,
padding?.bottom,
padding?.right,
]);
addIfNonNull('showReportFeedbackButton', showReportFeedbackButton);
addIfNonNull('showEndOfRouteFeedback', showEndOfRouteFeedback);
addIfNonNull('isCustomizeUI', isCustomizeUI);
return optionsMap;
}