decodeGoToSourceRequest function

(List<SourceFrame>, int) decodeGoToSourceRequest(
  1. String json
)

Decode a goToSource request from a JSON string.

Implementation

(List<SourceFrame>, int) decodeGoToSourceRequest(String json) {
  final map = jsonDecode(json) as Map<String, dynamic>;
  final framesRaw = map['frames'] as List<dynamic>;
  final index = (map['index'] as int?) ?? 0;
  final frames = framesRaw
      .map((raw) => SourceFrame.fromJson(raw as Map<String, dynamic>))
      .toList();
  return (frames, index);
}