Newbie needs advice on structuring data

Hi guys! I need your advice on how to better organize data in a flexible sync realm (for Flutter).

I need to have a list of objects of different types. For example: [TypeA, TypeB, TypeA, TypeC, TypeA]. The objects represent different items contained in a folder, and for each one, the UI displays a widget on the screen.

I was considering different approaches, but two of them seem more appropriate. Both of them rely on some intermediate connecting object.

1

The first idea is to use a RealmValue, which will contain a DBRef link to an object of any type.
class RVConnection {
ObjectId _id
RealmValue item
}

RVList {

List list
}

2

The second idea is to simply hold an ObjectId of a linked object.
class SimpleConnection {
ObjectId _id
ObjectId itemId
}

SimpleList {

List list
}

===

In the first approach, all changes inside the objects will be notified to the listener of the list. But in the second approach, there is no such functionality. However, I’m not sure if I need it.

I like the second option for its simplicity. However, I’m waiting for some feedback from experienced peers. Is it a good idea? What comes to mind is that to display widgets, I will need to not only query connections in a list but also (for each widget) query its object by its id, and to watch for any changes in these queries. For example, is it okay to listen for changes in 20 different objects on the screen at the same time? Should be easy for Realm, what do you think?