defaultAnnotationFromJson function

Annotation defaultAnnotationFromJson(
  1. Map<String, dynamic> json
)

Default factory for deserializing built-in annotation types.

Handles: 'sticky', 'group', 'marker' types. Throws ArgumentError for unknown types.

Implementation

Annotation defaultAnnotationFromJson(Map<String, dynamic> json) {
  final type = json['type'] as String;
  return switch (type) {
    'sticky' => StickyAnnotation.fromJsonMap(json),
    'group' => GroupAnnotation.fromJsonMap(json),
    'marker' => MarkerAnnotation.fromJsonMap(json),
    _ => throw ArgumentError('Unknown annotation type: $type'),
  };
}