Closed harishrathi closed 4 years ago
I couldn't test your code because you didn't give a minimal reproducible example.
However, I got similar error sometimes when Dart couldn't infer the type. This may be the case, as pointed by the dynamic in the error.
Try passing the type explicitily to .attempt<T>
.
That helped. Closing the issue.
Great! Thanks for helping, @mateusfccp!
I have all my API calls returning Either<ApiException, Result> e.g.
But if exception is thrown inside a function, like below
Then
attempt()
should catch them asApiException
. Currently it gives errortype 'Future<Either<ApiException, dynamic>>' is not a subtype of type 'FutureOr<Either<ApiException, SendOtpDto>>
This is how I am calling the API