PlatformException(token_failed, Concurrent operations detected: token, token, null, null)
Hey, I went through all the comments in the previous issues, but still, nothing worked for me. I am continuously getting this error. Please help!

.
@Dimple-Liberohealth can you paste a code snippet of where this exception occurs?
I have same issue. so android user can't login :(
@MaikuB Maybe considering let exception caused by checkAndSetPendingOperation has a different error code? So it can be identified from flutter code easier. Or having an parameter to ignore the later call if previous one haven't finished?
Right now the only way to distinguish the concurrent operation error from the real error is by parsing the localized error message, as the token is always TOKEN_ERROR_CODE, which isn't really helpful in this case.
private void checkAndSetPendingOperation(String method, Result result) {
if (pendingOperation != null) {
throw new IllegalStateException(
"Concurrent operations detected: " + pendingOperation.method + ", " + method);
}
pendingOperation = new PendingOperation(method, result);
}
I can make a PR for this change later, but right now, I'm quite occupied.
Go through the issue again, I think in general, ConcurrentOperation should be considered as an error instead of an exception in dart language semantics.
As it is generated on by native code, so it is thrown as PlatformException, but in a ideal world, this case should be handled separately than the actual token exceptions.
@timnew Understand the error vs exception argument, however this is all based on how the Flutter APIs have been defined, which you can see in a number of places
- Method channel implementations for Flutter plugins call this method, which explicitly states the kind of exception that can be thrown
- Calling this on native results in
PlatformException - The description for the PlatformException itself that's to do with failures to do with the plugin. Note if the guard wasn't in place then the failure here as I understand it is in distinguishing results for multiple intents being triggered on Android side
As such, numerous plugins follow the same approach. In fact, I've modelled this particular one from one of Google's official plugins (see https://github.com/flutter/plugins/blob/cfbdcd0b40faabfbd345ea4d6498efd99affe838/packages/google_sign_in/google_sign_in_android/android/src/main/java/io/flutter/plugins/googlesignin/GoogleSignInPlugin.java#L320). Based on this, I would say it's working as designed. I haven't come across plugins trying to catch these and throw an error instead, which would likely make it more difficult to use tools like pigeon to generate code for plugins