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

Bad state: Future already completed when using CachedNetworkImageProvider #11

Closed
mark8044 opened this issue Dec 2, 2023 · 2 comments · Fixed by #12
Closed

Bad state: Future already completed when using CachedNetworkImageProvider #11

mark8044 opened this issue Dec 2, 2023 · 2 comments · Fixed by #12
Assignees

Comments

@mark8044
Copy link

mark8044 commented Dec 2, 2023

The package works wonderfully when using NetworkImage provider

final imageProvider = NetworkImage(imageUrl);
final String blurHash = await BlurhashFFI.encode(imageProvider);

However, when trying to use a CachedNetworkImageProvider:

final imageProvider = CachedNetworkImageProvider(imageUrl);
final String blurHash = await BlurhashFFI.encode(imageProvider);

Then we get the following error:

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Bad state: Future already completed
#0      _AsyncCompleter.complete (dart:async/future_impl.dart:43:31)
#1      BlurhashFFI._getImageInfoFromImageProvider.<anonymous closure> (package:blurhash_ffi/blurhash.dart:195:17)
<asynchronous suspension>

Despite the error, a blur hash string is still returned....

@drxddy
Copy link
Member

drxddy commented Dec 2, 2023

Hey @mark8044, this is a known issue caused by cached_network_image package, please follow #6 for updates

@mark8044
Copy link
Author

mark8044 commented Dec 2, 2023

@dhikshith12 Ah ok I see, I will follow there, thank you

@mark8044 mark8044 closed this as completed Dec 2, 2023
@mark8044 mark8044 reopened this Dec 2, 2023
@drxddy drxddy closed this as completed in #12 Dec 3, 2023
drxddy added a commit that referenced this issue Dec 3, 2023
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

Successfully merging a pull request may close this issue.

2 participants