MarkerShape.fromJson constructor

MarkerShape.fromJson(
  1. Map<String, dynamic> json
)

Creates a MarkerShape from JSON

Implementation

factory MarkerShape.fromJson(Map<String, dynamic> json) {
  final type = json['type'] as String;

  switch (type) {
    case 'none':
      return const NoneMarkerShape();
    case 'circle':
      return const CircleMarkerShape();
    case 'rectangle':
      return const RectangleMarkerShape();
    case 'diamond':
      return const DiamondMarkerShape();
    case 'triangle':
      return const TriangleMarkerShape();
    case 'capsuleHalf':
      return const CapsuleHalfMarkerShape();
    default:
      throw ArgumentError('Unknown marker shape type: $type');
  }
}