fluttercommunity / flutter_downloader

Flutter Downloader - A plugin for creating and managing download tasks.
https://pub.dev/packages/flutter_downloader
BSD 3-Clause "New" or "Revised" License
907 stars 511 forks source link

Negative progress #956

Open hirosz opened 4 months ago

hirosz commented 4 months ago

Hi! When i try to dowanload with listen to progress i only get progress: 0, thn some negative value and at the end 100. Nothing in between. What could be wrong?


  Future<void> _initialize() async {
    await _initializePreferences();
    refreshDownloadTasks();
    bindBackgroundIsolate();
    FlutterDownloader.registerCallback(downloadCallback, step: 1);
  }

  void bindBackgroundIsolate() {
    final isSuccess = IsolateNameServer.registerPortWithName(
      _port.sendPort,
      'downloader_send_port',
    );
    if (!isSuccess) {
      unbindBackgroundIsolate();
      bindBackgroundIsolate();
      return;
    }

    _port.listen((dynamic data) async {
      final taskId = (data as List<dynamic>)[0] as String;
      final status = DownloadTaskStatus.fromInt(data[1] as int);
      final progress = data[2] as int;

      logger.i(
        'Callback on UI isolate: '
            'task ($taskId) is in status ($status) and process ($progress)',
      );

      if (_tasks.isNotEmpty) {
        final task = _tasks.firstWhere((task) => task.taskId == taskId);
        task
          ..status = status
          ..progress = progress;

        // Emit the status change

        if (status == DownloadTaskStatus.complete) {
          await handleZipFile();
          refreshDownloadTasks();
        }
        _downloadStatusController.add(status);

      }
    });
  }
salmaahhmed commented 4 months ago

@hirosz can you send me what you're trying to download ?

hirosz commented 4 months ago

@hirosz can you send me what you're trying to download ?

zip file from firebase hosting: https://superstories-7538f.web.app/models/modelen.zip

hirosz commented 4 months ago

moved to AWS and now it's ok