1

I ask you a quwstion because i Need to develop an application with background synchronization. I tried to look around but i didn't find something usefull. My requirement Is to do background fetch of datas from apis and save them to database. One sunchronization can be heavy(12k inserits). It this process block UI?

The user could continue to use app while synchronizing.

Thank you

Marco Moretti
  • 689
  • 4
  • 11

2 Answers2

0

For heavy read/write, you can use https://pub.dev/packages/hive instead of sqlite
Hive have better performance than sqlite

enter image description here

chunhunghan
  • 51,087
  • 5
  • 102
  • 120
0

You need to use a dedicated isolate to perform heavy calculations, for that you can use compute

final data = await compute(callback, arguments);

Documentation: https://api.flutter.dev/flutter/foundation/compute.html

Example: Flutter- compute method

Christopher Moore
  • 15,626
  • 10
  • 42
  • 52
ASAD HAMEED
  • 2,296
  • 1
  • 20
  • 36