Closed Gaurav-CareMonitor closed 9 months ago
This is expected behavior. The function sdkAuthWithLicense
has a return type of a boolean so the generated function is also returning bool
and not Future<bool>
.
So is there no way of getting data from Future Java functions? @HosseinYousefi
The function you mention is not even a Future
it seems. There are many different ways of creating asynchronous methods in other langauges. For example, in android, you might get a Task<T>
back. In this case, the correct way to consume the result of this "task" is to addOnCompleteListener
and such methods. Java also have a Future
class. Kotlin uses suspendable functions. A library creator can create an arbitrary class similar to Task
that can act async. Etc.
Therefore, it's not really possible to account for ALL of these different constructs and convert them all into Futures
(to enable async/await) in Dart. You can still add the callbacks for classes such as Task
(similar to .then
in Future
s in Dart) and use them.
There is a direct translation from Kotlin's suspend fun
to Dart's async
method that jnigen supports. For all the other constructions, you would have to use some form of callback.
The function getting generated are not Futures even tho it is supposed to be.
This function should be awaited.
Code: here
Here is the yaml file: