ARBItemAnnotationPlaceholder.fromJson constructor

ARBItemAnnotationPlaceholder.fromJson(
  1. ARBItemPlaceholderKey key,
  2. Map<String, dynamic> json
)

Implementation

factory ARBItemAnnotationPlaceholder.fromJson(
  ARBItemPlaceholderKey key,
  Map<String, dynamic> json,
) {
  final otherAttributeKeys =
      json.keys.where((x) => x != 'type' && x != 'example' && x != 'format');

  final otherAttributes = otherAttributeKeys.isNotEmpty
      ? otherAttributeKeys
          .map((x) => MapEntry<String, dynamic>(x, json[x]))
          .toMap()
      : null;

  return ARBItemAnnotationPlaceholder(
    key: key,
    type: json.lookup('type'),
    example: json.lookup('example'),
    format: json.lookup('format'),
    otherAttributes: otherAttributes,
  );
}