Hey i'm trying to add a reorderable list view to a list but, i'm getting an issue and i don't know why.
error: package:flutter/src/widgets/framework.dart': Failed assertion: line 5403 pos 14: '_dependents.isEmpty': is not true.
My list is called toDoList and its in a database for saving on your device. database is db
Here is the Reorderable List View part of my code.
body: ReorderableListView.builder(
itemCount: db.toDoList.length,
//this code is uesd to reorder the list
onReorder: (oldIndex, newIndex) => setState(() {
final index = newIndex;
final item = db.toDoList.removeAt(index);
db.toDoList.insert(index, item);
}),
itemBuilder: (context, index) {
//code is needed to define each item on list as item
final item = db.toDoList[index];
return toDoTile(
//key is used to set each item on list as unique
key: ValueKey(item),
taskName: db.toDoList[index][0],
taskCompleted: db.toDoList[index][1],
onChanged: (value) => checkBoxChanged(value, index),
deleteFunction: (context) => deleteTask(index),
editTask: (context) => editTask(index),
);
},
),
);
}
any idea why i'm having this issue?