toMap method

Map<String, dynamic> toMap()

Implementation

Map<String, dynamic> toMap() => {
      'apiKey': apiKey,
      'origin': origin.toMap(),
      'destination': destination.toMap(),
      if (intermediates.isNotEmpty)
        'intermediates': intermediates.map((w) => {
              if (w.location != null) 'location': w.location!.toMap(),
              if (w.placeId != null) 'placeId': w.placeId,
              if (w.via != null) 'via': w.via,
              if (w.sideOfRoad != null) 'sideOfRoad': w.sideOfRoad,
            }).toList(growable: false),
      'languageCode': languageCode,
      if (colorPrimary != null) 'colorPrimary': _argbColorInt(colorPrimary!),
      if (colorOnPrimary != null) 'colorOnPrimary': _argbColorInt(colorOnPrimary!),
      if (colorSurface != null) 'colorSurface': _argbColorInt(colorSurface!),
      if (colorOnSurface != null) 'colorOnSurface': _argbColorInt(colorOnSurface!),
      if (mapId != null) 'mapId': mapId,
      'themeMode': themeMode.name,
    };