decodeCategory function

MediaPipeCategory decodeCategory(
  1. Map<Object?, Object?> json
)

Decodes a category. A missing index is -1, as Google's C API reports it.

Implementation

MediaPipeCategory decodeCategory(Map<Object?, Object?> json) =>
    MediaPipeCategory(
      index: (json['index'] as num?)?.toInt() ?? -1,
      score: (json['score'] as num).toDouble(),
      categoryName: decodeLabel(json['categoryName']),
      displayName: decodeLabel(json['displayName']),
    );