convertParameterTypesToHealthDataType function

Future<List<HealthPermission>> convertParameterTypesToHealthDataType(
  1. List<GoogleParameterTypeClient?> parameterTypes
)

Implementation

Future<List<HealthPermission>> convertParameterTypesToHealthDataType(
    List<GoogleParameterTypeClient?> parameterTypes) async {
  final List<HealthPermission> healthPermissions = [];
  for (GoogleParameterTypeClient? element in parameterTypes) {
    for (HealthDataType healthDataType in HealthDataType.values) {
      if (healthDataType.name == element?.googleParameterType?.parameterType) {
        healthPermissions.add(
          HealthPermission(
            healthDataType: healthDataType,
            healthDataAccess: getHealthDataAccessFromString(
              element?.permissionType,
            ),
          ),
        );
      }
    }
  }
  return healthPermissions;
}