factory static method
Factory method to create instances as a result of HealthKitReporter.sampleQuery
Implementation
static Sample? factory(Map<String, dynamic> json) {
final identifier = json['identifier'];
final quantityType = QuantityTypeFactory.tryFrom(identifier);
if (quantityType != null) {
return Quantity.fromJson(json);
}
final categoryType = CategoryTypeFactory.tryFrom(identifier);
if (categoryType != null) {
return Category.fromJson(json);
}
final workoutType = WorkoutTypeFactory.tryFrom(identifier);
if (workoutType != null) {
return Workout.fromJson(json);
}
final correlationType = CorrelationTypeFactory.tryFrom(identifier);
if (correlationType != null) {
return Correlation.fromJson(json);
}
final electrocardiogramType =
ElectrocardiogramTypeFactory.tryFrom(identifier);
if (electrocardiogramType != null) {
return Electrocardiogram.fromJson(json);
}
final clinicalRecordType = ClinicalTypeFactory.tryFrom(identifier);
if (clinicalRecordType != null) {
return ClinicalRecord.fromJson(json);
}
return null;
}