Rank 1: Thread
Hello guys,
I am implementing a flutter application which communicates with the cloud appwrite system. On the login step I try to add a push target if this target is missing. The code for this looks like:
Future<void> setUserTarget(String? fcmToken, User user) async { if (fcmToken != null) { if (user.targets.isEmpty || !user.targets.any((targe) => targe.providerType == 'push')) { await _account.createPushTarget( targetId: user.$id, identifier: fcmToken, providerId: PROVIDER_ID); } else { await _account.updatePushTarget( targetId: user.$id, identifier: fcmToken); } } }When I debug through the code I get this state of the user is targest list is empty (see screenshot), but after caling the _account.createPushTarget() function I get the error message: A target with the same ID already exists (see the second screenshot)
I also checked the appwrite console and there is not target for the user.
I am not sure what the problem is. Can anybody help?
Kind regards