fromWire static method

Implementation

static ZorphyBoundaryResult<AlternativesLookupIntent> fromWire(
  Map<String, Object?> raw,
) {
  final violations = <FieldViolation>[];
  final Object? raw_maxPrice = raw['maxPrice'];
  double? _maxPrice;
  if (raw_maxPrice != null) {
    _maxPrice = _boundaryDouble(raw_maxPrice, '/maxPrice', violations);
  }
  final Object? raw_limit = raw['limit'];
  int? _limit;
  if (raw_limit != null) {
    _limit = _boundaryAs<int>(raw_limit, '/limit', violations);
  }
  if (violations.isNotEmpty) {
    return BoundaryErr<AlternativesLookupIntent>(
      targetType: 'AlternativesLookupIntent',
      violations: violations,
    );
  }
  return BoundaryOk<AlternativesLookupIntent>(
    AlternativesLookupIntent(maxPrice: _maxPrice, limit: _limit),
  );
}