AnalysisHandleWatchEventsParams.fromJson constructor

AnalysisHandleWatchEventsParams.fromJson(
  1. JsonDecoder jsonDecoder,
  2. String jsonPath,
  3. Object? json, {
  4. ClientUriConverter? clientUriConverter,
})

Implementation

factory AnalysisHandleWatchEventsParams.fromJson(
  JsonDecoder jsonDecoder,
  String jsonPath,
  Object? json, {
  ClientUriConverter? clientUriConverter,
}) {
  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,
          clientUriConverter: clientUriConverter,
        ),
      );
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'events');
    }
    return AnalysisHandleWatchEventsParams(events);
  } else {
    throw jsonDecoder.mismatch(
      jsonPath,
      'analysis.handleWatchEvents params',
      json,
    );
  }
}