subscribeUploadProgress method

Future<StreamSubscription> subscribeUploadProgress(
  1. String url,
  2. String eventName,
  3. dynamic eventMethod, {
  4. dynamic onErrorMethod,
})

Implementation

Future<StreamSubscription<dynamic>> subscribeUploadProgress(
    String url, String eventName, eventMethod,
    {onErrorMethod}) async {
  Map<String, Object> data = Map();

  data["url"] = url;

  await _fileModule.invokeMethod(SUBSCRIBE_UPLOAD_PROGRESS_METHOD, data);
  return EventChannel(eventName)
      .receiveBroadcastStream(eventName)
      .listen(eventMethod, onError: onErrorMethod);
}