I have a ListView of custom objects.
I'd like to insert a variety of other custom objects into my list.
So the goal would be something like this:
CustomObjectA
CustomObjectA
CustomObjectB
CustomObjectA
CustomObjectA
CustomObjectA
CustomObjectC
CustomObjectA
CustomObjectA
CustomObjectA
CustomObjectC
I may have some that I want to go to a specific row, whereas others may be every nth row.
The problem I see is I have List<dynamic> objects
, but if I do something like:
objects.insert(
3,
CustomObjectB(),
);
I get an error as CustomObjectB
is NOT a CustomObjectA
.
What is the best way to achieve this?
CodePudding user response:
If the objects you add to ListView (ex. CustomObjectA) are Widgets, then List objects update it to List.
Or you can use List but if they are widgets List is required