0

Is there are good way to find out what the total number of records to be synced will be before the records are actually synced via the datastore? This is refering to at the start of time when I am going to sync the datastore with what's in the cloud (so the downstream sync). I'm wanting to create an actual progress indicator for the user (since it takes about a minute for ~1500 records to sync), and don't want to just put up a CircleProgressIndicator().

All I'm currently able to do is:

hubSubscription = Amplify.Hub.listen([HubChannel.DataStore], (msg) {
        if (msg.eventName == "ready") {
          getAllDevicesInDataStore().then((value) => stopListeningToHub());
        }
        if (kDebugMode) {
          if (msg.eventName == "modelSynced") {
            final syncedModelPayload = msg.payload as ModelSyncedEvent;
            print(
                'Model: ${syncedModelPayload.modelName}, Delta? ${syncedModelPayload.isDeltaSync}');
            print(
                '${syncedModelPayload.added}, ${syncedModelPayload.updated}, ${syncedModelPayload.deleted}');
          }
        }
      });

I can implement a CircleProgressIndicator() while this is happening, but I want something more definitive.

Adam T
  • 11
  • 2
  • Why don't you give the delta data to the CircularProgressIndicator? – salihgueler Jan 11 '23 at 10:16
  • It's the other way around. There's no delta at the initial sync b/c I don't believe there's actually a datastore at that point. Or, it's empty at least. – Adam T Jan 12 '23 at 23:43

0 Answers0