fromJson property

Marker fromJson

Implementation

Marker get fromJson {
  var bitmap = markerJson['icon'] != null
      ? BitmapDescriptor.fromJson(markerJson['icon'])
      : BitmapDescriptor.defaultMarker;

  var infoWindow = markerJson['infoWindow'] != null
      ? InfoWindow(
          anchor: Offset(markerJson['infoWindow']['anchor']![0],
              markerJson['infoWindow']['anchor']![1]),
          title: markerJson['infoWindow']['title'],
          snippet: markerJson['infoWindow']['snippet'],
        )
      : InfoWindow.noText;

  var anchor = markerJson['anchor'] != null
      ? Offset(markerJson['anchor']![0], markerJson['anchor']![1])
      : const Offset(0.5, 1.0);

  return Marker(
    markerId: markerId,
    position: toLatLng,
    rotation: bearing,
    icon: bitmap,
    alpha: markerJson['alpha'] ?? 1.0,
    anchor: anchor,
    flat: markerJson['flat'] ?? false,
    consumeTapEvents: markerJson['consumeTapEvents'] ?? false,
    draggable: markerJson['draggable'] ?? false,
    visible: markerJson['visible'] ?? true,
    zIndex: markerJson['zIndex'] ?? 0.0,
    infoWindow: infoWindow,
  );
}