isar / isar/hive

HiveList<HiveObjectMixin>?' can't be assigned to a variable of type 'HiveList<HiveObjectMixin>

Open
#760 0 comments 0 reactions 0 assignees View on GitHub
problem
Dominant language
Dart
Stars
4.4k
Forks
449
PR merge metrics
No merged PRs in 30d

Description

after build created database structure i get this error on `TABLE.g.dart` file:

error: A value of type 'HiveList?' can't be assigned to a variable of type 'HiveList'. (invalid_assignment at [XXXX] lib/database/user.g.dart:22)

for example:

```dart
return User()
..nameFamily = fields[0] as String
..mobileNumber = fields[1] as String
..address = (fields[2] as HiveList)?.castHiveList()
..wallet = (fields[3] as HiveList)?.castHiveList()
..transactions = (fields[4] as HiveList)?.castHiveList()
..categories = (fields[5] as HiveList)?.castHiveList()
..services = (fields[6] as HiveList)?.castHiveList();
```

removing `?` from `HiveList)?.castHiveList()` cause resolve this problem

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.