getDataStreamBatches method

Future<List<DataStreamBatch>> getDataStreamBatches()

Get the list of DataStreamBatch which has not yet been uploaded.

If delete is true, the data will be deleted from this buffer. Otherwise, data will be kept in the buffer (the SQLite database) and marked as uploaded. This happens within a database transaction and needs to be committed using the commit method at some stage.

Returns an empty list if no data needs to be uploaded.

Implementation

Future<List<DataStreamBatch>> getDataStreamBatches() async {
  List<DataStreamBatch> batches = [];

  if (deployment != null) {
    for (var stream in deployment!.expectedDataStreams) {
      var batch = await getDataStreamBatch(stream);
      if (batch != null) batches.add(batch);
    }
  }
  return batches;
}