question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Binding doesn't support coroutines

See original GitHub issue

I was excited to try out the binding block in our codebase but it doesn’t support suspending functions. We currently use Result heavily with coroutines so this was a bit of a bummer. Is there any likelihood of this being added in the future? I’m not sure if it’s out of scope for this project. I’m happy to raise a PR if you think it would be a worthwhile addition.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:21 (12 by maintainers)

github_iconTop GitHub Comments

4reactions
Munzeycommented, Aug 18, 2020

@badvok666 @ditn regarding

IIRC you’re having issues because you’re using a method reference. We use andThen with suspending functions all the time.

It looks like when we bump this lib to 1.4 that will no longer be an issue, see section “Suspend conversion on callable references”:

https://kotlinlang.org/docs/reference/whatsnew14.html#callable-reference-improvements

3reactions
michaelbullcommented, Jul 19, 2020

Released in 1.1.8

Read more comments on GitHub >

github_iconTop Results From Across the Web

Two-way databinding not working when triggered inside ...
In my case, the problem was solved by setting the value of the lifecycleOwner property in the following code. The data binding is...
Read more >
Exception when trying to use Kotlin coroutines. - MSDN
I have an Android Binding Library with Kotlin code, and it exits whenever it hits ... StdLib doesn't include support for Kotlin coroutines....
Read more >
Best practices for coroutines in Android
This page presents several best practices that have a positive impact by making your app more scalable and testable when using coroutines.
Read more >
Coroutines basics - Kotlin
However, a coroutine is not bound to any particular thread. It may suspend its execution in one thread and resume in another one....
Read more >
Blocking threads, suspending coroutines | by Roman Elizarov
However, it does not over-allocate threads, since that would not help to execute CPU-bound tasks faster, but only waste memory.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found