Unhandled Exception: type 'MeasurementType' is not a subtype of type 'UserSetting' of 'obj'
Nobody has claimed this yet.
- Dominant language
- Dart
- Stars
- 4.4k
- Forks
- 449
- PR merge metrics
- No merged PRs in 30d
Description
I already have UserSettingAdapter() and MeasurementTypeAdapter(),
this is my class
//User class
@HiveType(typeId: 1)
class UserSetting {
@HiveField(0)
final String userId;
@HiveField(1)
final List listFavorite;
UserSetting(this.userId, this.listFavorite);
}
//MeasurementType enum
@HiveType(typeId: 2)
enum MeasurementType {
@HiveField(0)
heartRate,
@HiveField(1)
heartRateVariability,
@HiveField(2)
restingHeartRate,
@HiveField(3)
bloodPressure,
@HiveField(4)
spO2,
@HiveField(5)
bodyTemperature,
@HiveField(6)
weight,
@HiveField(7)
sleep,
@HiveField(8)
steps,
@HiveField(9)
walking,
@HiveField(10)
running,
@HiveField(11)
medication,
@HiveField(12)
qol,
// Using for Biokit device measurement
spo2AndHearRate,
bpmAndHeartRate;
}
when i use put to insert data to table it show error Unhandled Exception: type 'MeasurementType' is not a subtype of type 'UserSetting' of 'obj':
Future upsertData(
{required Box box, required String key, dynamic value}) async {
await box.put(key, value);
}
await upsertData(userSetting.userId, userSetting);
any solution ?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the UserSetting and MeasurementType declarations, their adapters, and the upsertData entry point shown in the issue. Reproduce the box.put call with the supplied values and verify the box's expected value type. Done means the UserSetting can be inserted without a runtime type error and can be read back correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart
- Domain
- database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100