propertyFromCaptureProperty function

Property propertyFromCaptureProperty(
  1. CaptureProperty prop
)

Helper for determining which property generic value (from response) should be assigned to.

Implementation

Property propertyFromCaptureProperty(CaptureProperty prop) {
  final Property out = Property()
    ..id = prop.id
    ..type = prop.type
    ..dataSourceValue = DataSourceIos()
    ..versionValue = Version();
  switch (prop.type) {
    case CapturePropertyTypes.dataSource:
      final DataSource ds = prop.dataSource;
      out.dataSourceValue = DataSourceIos()
        ..id = ds.id
        ..name = ds.name
        ..status = ds.status
        ..flags = ds.flags;
      break;
    case CapturePropertyTypes.array:
      out.arrayValue = Uint8List.fromList(prop.array);
      break;
    case CapturePropertyTypes.string:
      out.stringValue = prop.string;
      break;
    case CapturePropertyTypes.byte:
      out.byteValue = prop.byte;
      break;
    case CapturePropertyTypes.ulong:
      out.longValue = prop.ulong;
      break;
    case CapturePropertyTypes.object:
      out.objectValue = prop.object;
      break;
    case CapturePropertyTypes.version:
      out.versionValue = prop.version;
      break;
    // case CapturePropertyTypes.Enum:
    //   out.enumValue = prop.Enum;
    //   break;
  }
  return out;
}