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

dont update ui on progress call back #846

Open
hoangtienak2 opened this issue Jul 13, 2022 · 0 comments
Open

dont update ui on progress call back #846

hoangtienak2 opened this issue Jul 13, 2022 · 0 comments

Comments

@hoangtienak2
Copy link

hoangtienak2 commented Jul 13, 2022

i have progress bar and need progress upload from dio. This is my store code

  @observable
  int? uploadProgress;

Future addPost(PostBundle postBundle) async {
    PostBundle getPostBundle = postBundle;
    updateListPostUploading(postBundle: getPostBundle);
    uploadProgress = 2; // ui update 
    for (var i = 0; i < 1000; i++) {
      uploadProgress = 9; // ui update 
    }
    await Future.delayed(Duration(seconds: 3), () {});
    getPostBundle.uploadProgress = 12; // ui update 

    if (getPostBundle.files != null && getPostBundle.files!.length > 0) {
      return await uploadFile(
              listImages: postBundle.files!,
              onProgress: (va, va2) {
                uploadProgress = va;  // ui update 
              })
          .then((value) => removeListPostUploading(postBundle: getPostBundle));
    }
  }

when uploadProgress = 2 , 9, 12 UI updated nomarly
but when i set uploadProgress = va UI not update.

Please help me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant