CompletionHandler typedef
If you want the animation I support you should modify your data source first,then wait handler to execute,after that, you can call setState to update your UI.
Code Example:
initState() {
List list = [1,2,3,5];
}
onTap(handler) async {
list.removeAt(2);
// true: will delete this row in ListView
// false: will not delete it
// Q: When to use "await"?
// A: The time when you want animation
await handler(true or false);
setState((){});
}
Implementation
typedef CompletionHandler = Future<void> Function(bool delete);