Browse SDKs · Flutter
SDKsFlutter

Track file upload progress

Configure the Flutter SDK listener for independent file uploads.

Copy

Configure one OnUploadFileListener in the shared upload state layer:

OpenIM.iMManager.setUploadFileListener(
  OnUploadFileListener(
    onUploadProgress: (id, fileSize, streamSize, storageSize) {
      updateFileProgress(id, streamSize, fileSize);
    },
    onComplete: (id, size, url, type) {
      completeFileUpload(id, size, url, type);
    },
  ),
);

The pinned Flutter SDK retains only one listener, so a later value replaces the previous one, and it does not expose a removal method. When switching accounts, stop dispatching into the old state and clear the task map. Associate callbacks by the business id, not by file name or list position.