isLinkedWithGamesServices method

bool isLinkedWithGamesServices()

Checks if the current Firebase user is linked with Play Games (Android) or Game Center (iOS).

Returns true if the user's account is linked with either Play Games (on Android) or Game Center (on iOS), and false otherwise.

Throws UnimplementedError for unsupported platforms (non-Android, non-iOS).

Implementation

bool isLinkedWithGamesServices() {
  // Check if Play Games is linked on Android.
  if (Platform.isAndroid) {
    return providerData.any((UserInfo info) =>
        info.providerId == PlayGamesAuthProvider.PROVIDER_ID);
  }

  // Check if Game Center is linked on iOS.
  if (Platform.isIOS) {
    return providerData.any((UserInfo info) =>
        info.providerId == GameCenterAuthProvider.PROVIDER_ID);
  }

  throw UnimplementedError('This platform is not supported.');
}