read method

  1. @override
AppleHealthElement read(
  1. BinaryReader reader
)
override

Is called when a value has to be decoded.

Implementation

@override
AppleHealthElement read(BinaryReader reader) {
  final numOfFields = reader.readByte();
  final fields = <int, dynamic>{
    for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
  };
  return AppleHealthElement(
    id: fields[0] as String?,
    value: fields[1] as String?,
    date: fields[2] as String?,
    synced: fields[3] as bool?,
    syncedDate: fields[4] as String?,
    dateFrom: fields[5] as String?,
    dateTo: fields[6] as String?,
    type: fields[7] as String?,
    healthValue: fields[8] as String?,
    deviceId: fields[9] as String?,
    sourceId: fields[10] as String?,
    platform: fields[11] as String?,
    uuid: fields[12] as String?,
    deviceName: fields[13] as String?,
  );
}