AnalysisHandleWatchEventsParams.fromJson constructor

AnalysisHandleWatchEventsParams.fromJson(
  1. JsonDecoder jsonDecoder,
  2. String jsonPath,
  3. Object? json
)

Implementation

factory AnalysisHandleWatchEventsParams.fromJson(
    JsonDecoder jsonDecoder, String jsonPath, Object? json) {
  json ??= {};
  if (json is Map) {
    List<WatchEvent> events;
    if (json.containsKey('events')) {
      events = jsonDecoder.decodeList(
          '$jsonPath.events',
          json['events'],
          (String jsonPath, Object? json) =>
              WatchEvent.fromJson(jsonDecoder, jsonPath, json));
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'events');
    }
    return AnalysisHandleWatchEventsParams(events);
  } else {
    throw jsonDecoder.mismatch(
        jsonPath, 'analysis.handleWatchEvents params', json);
  }
}