I'm using the Isar database in a Flutter application, but I'm unable access the properties of a stored object. I'm only able to retrieve an Instance of the Object.
This is my collection:
@Collection()
class User{
Id? id;
late String name;
late String email;
@Index()
late String phone;
}
This is how I'm trying to access the record from the login page:
final users = widget.isar.users.where() .phoneEqualTo(phone) .findAll();
In this case users is returned as [Instance of 'User']
I want to access the name of the record corresponding to the phone number. How would I go about this? Thanks in advance!
@Sharvan Kumaran Simply get the initial element and convert it into a User object.