canParse static method

bool canParse(
  1. Object? obj
)

Implementation

static bool canParse(Object? obj) {
  if (obj is! Map<String, dynamic>) {
    return false;
  }
  if ((obj['checksums'] is! List ||
      (obj['checksums'].any((item) => !Checksum.canParse(item))))) {
    return false;
  }
  if (obj['name'] is! String?) {
    return false;
  }
  if (obj['origin'] is! String?) {
    return false;
  }
  if (obj['path'] is! String?) {
    return false;
  }
  if (obj['presentationHint'] is! String?) {
    return false;
  }
  if (obj['sourceReference'] is! int?) {
    return false;
  }
  if ((obj['sources'] is! List ||
      (obj['sources'].any((item) => !Source.canParse(item))))) {
    return false;
  }
  return true;
}