task method

Future task({
  1. required CAsyncTask task,
  2. dynamic data,
  3. int delay = 0,
})

Will process a one off asynchronous task on the main flutter thread.

Implementation

Future<dynamic> task({
  required CAsyncTask task,
  dynamic data,
  int delay = 0,
}) async {
  return (
    await Future.delayed(
      Duration(milliseconds: delay),
      () => task(data),
    ),
  );
}