removeIfSafe method

Future<AuthAuthenticationMethodMutationResult> removeIfSafe({
  1. required String userId,
  2. required AuthAuthenticationMethod target,
  3. required AuthAuthenticationMethodMutation mutate,
})

Removes target only when another known usable method remains.

Implementation

Future<AuthAuthenticationMethodMutationResult> removeIfSafe({
  required String userId,
  required AuthAuthenticationMethod target,
  required AuthAuthenticationMethodMutation mutate,
}) async {
  _ensureComposed();
  final store = _mutationStore;
  if (store == null) {
    return AuthAuthenticationMethodMutationResult.atomicityUnavailable;
  }
  final normalizedUserId = _component(userId, 'userId', maxLength: 512);
  return store.mutateAuthenticationMethodIfSafe(
    userId: normalizedUserId,
    target: target,
    loadInventory: () => _loadInventory(normalizedUserId),
    mutate: mutate,
  );
}