Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Negative progress #956

Open
hirosz opened this issue May 22, 2024 · 3 comments
Open

Negative progress #956

hirosz opened this issue May 22, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@hirosz
Copy link

hirosz commented May 22, 2024

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);

      }
    });
  }
@hirosz hirosz added the bug Something isn't working label May 22, 2024
@salmaahhmed
Copy link
Collaborator

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

@hirosz
Copy link
Author

hirosz commented May 23, 2024

@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
Copy link
Author

hirosz commented May 23, 2024

moved to AWS and now it's ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants