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

Workmanager does not execute future in callback #197

Closed
wolfc01 opened this issue Aug 12, 2020 · 3 comments
Closed

Workmanager does not execute future in callback #197

wolfc01 opened this issue Aug 12, 2020 · 3 comments

Comments

@wolfc01
Copy link

wolfc01 commented Aug 12, 2020

In the example I made the change:

      case simplePeriodicTask:
        print("$simplePeriodicTask was executed");
        Future.delayed(const Duration(milliseconds: 5500), () {
          print('Hello, world');
        });
        break;

But the "hello world" was not printed. Is this intended? If so, please explain the mechanism behind prohibiting the completion of the future.

Br
Carl.

@gebsl
Copy link

gebsl commented Aug 12, 2020

Could it be same problem/solution as here -> #171 (comment)?

You are not awaiting the delayed future. This might lead to the task already being finished before the future is resolved.

@Tienisto
Copy link

Tienisto commented Dec 6, 2020

await / async is working on my side. Probably await is missing in this code.

@ened
Copy link
Collaborator

ened commented Jan 31, 2022

Refer to the example for a dispatcher with await/async usage. https://github.com/fluttercommunity/flutter_workmanager/blob/main/example/lib/main.dart#L19

@ened ened closed this as completed Jan 31, 2022
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

4 participants