AnalyticsIsEnabledResult.fromJson constructor

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

Implementation

factory AnalyticsIsEnabledResult.fromJson(
    JsonDecoder jsonDecoder, String jsonPath, Object? json) {
  json ??= {};
  if (json is Map) {
    bool enabled;
    if (json.containsKey('enabled')) {
      enabled = jsonDecoder.decodeBool('$jsonPath.enabled', json['enabled']);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'enabled');
    }
    return AnalyticsIsEnabledResult(enabled);
  } else {
    throw jsonDecoder.mismatch(jsonPath, 'analytics.isEnabled result', json);
  }
}