AppFlowy-IO / appflowy-board

AppFlowy Board is a board-style widget that consists of multi-groups. It supports drag and drop between different groups. The AppFlowy Kanban Board project for AppFlowy and Beyond.

Home Page:https://appflowy.io/blocks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: "PhantomGroupItem is not a subtype of type TextItem"

simonbengtsson opened this issue · comments

When creating a board similar to the example you can get the runtime error mentioned in the title when you drag items around. The error appears when the group item list is not of the exact runtime type List<AppFlowyGroupItem>.

Here is an example of something that would cause the error to be thrown:

final items = ['Hello'].map((it) => TextItem(it))
AppFlowyGroupData(
   id: 'one',
   name: 'One',
   items: items.toList(),
);

A workaround is to use the List.from constructor:

final items = ['Hello'].map((it) => TextItem(it))
AppFlowyGroupData(
   id: 'one',
   name: 'One',
   items: List<AppFlowyGroupItem>.from(items),
);
commented

A workaround is to use the List.from constructor:

final items = ['Hello'].map((it) => TextItem(it))
AppFlowyGroupData(
   id: 'one',
   name: 'One',
   items: List<AppFlowyGroupItem>.from(items),
);

Thank you!