How to get total number of records to be synced in Flutter Amplify Datastore

164 views Asked by At

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.

0

There are 0 answers