'use a Future to feed a sync callback function

I already have posted a related question (here) but I'm still stuck with understanding the way to use async operation. I think I should be more specific,so i'm trying to build an app using the table-calendar package along with the sqfentity to manage the database.

The table-calendar package provides a customizable calendar. By providing a callback function with signature eventLoader (day)=>List, the calendar will mark each day with indicator about the number of event of this day.

The sqfentity packages allows to retrieve SQL results asynchronously, so I can retrieve Future<List> using this package.

Since the sqfentity result is a future, I cannot simply connect it to the eventLoader parameter of table-calendar.

I read about FutureBuilder to build the widget using async result, eventually showing some progress indicator until the actual result will be available, but as far as I understand, FutureBuilder requires the Future to be created outside and before the FutureBuilder build method,so without knowledge about the day for which the data have to be retrieved.

In my case, I need the Future to be created on the fly, during the call to eventLoader which will be called multiple time within the lifetime of the Calendar (each time the current month is changed).

So my question is, how should I feed the eventLoader function with the output of some Future<List> in flutter ?

Many thanks for any help...



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source