I have a list in hive of events each with an eventId field. In order to retrieve a specific event, I can retrieve the list from hive and do this to get the one I want.
var hiveEvents = HiveEvents.getAllEvents();
var ev = hiveEvents.firstWhere((event) => event.eventId == 8);
Is there a better way to pull just the event out of hive by passing the id, or is this the correct way to do it.
>Solution :
As it is written in the docs:
Hive does not have a query language and only has limited support for sorting, which is not necessarily a disadvantage, as you can see in the benchmark. Sorting and filtering are much faster if you do it yourself in Dart.
So getting the list and using List methods is the way to do that in Hive.
If you need to be able to query your data, you can use Isar which is a package from the same developer.