2

In my flutter app I need to query data from local database and lazy load the items to the ui. Currently using sqflite, the whole list is loaded before being returned. What is the best approach to go about?

I'm new to flutter but on android and ios previously running 'sqlite' query returns a Cursor object and for 'Realm database' it provides change listeners and lazy loading 'out of the box'.

Future<List<Map<String, dynamic>>> getData() async {
    Database db = await instance.database;
    return await db.query(table);
}

new FutureBuilder(future: getData(),
    builder: (BuildContext context, AsyncSnapshot snapshot){...})

I'm looking for a way to load the items one by one rather than having load indicator before loading the whole list.

0 Answers0