AccountMergeConfig class

Configuration for merging two AuthUsers.

When users need to be merged, your application must decide how to handle the data associated with each user. For example, if two accounts tied to the same person have conflicting data for certain fields, you must decide what data to merge, what data to discard, and what data to keep.

This class stores a list of callbacks which collectively solve that problem.

See also:

Constructors

AccountMergeConfig({AccountMergeHandler? applicationMergeHandler = defaultMergeHandler})
Creates a new AccountMergeConfig instance with the default merge hooks.
const
AccountMergeConfig.custom({required List<AccountMergeHandler> mergeHooks})
Creates a new AccountMergeConfig instance with a custom list of merge hooks.
const

Properties

applicationMergeHandler AccountMergeHandler?
Called when two auth users are merged. Application developers should write their application-specific merge logic here.
final
hashCode int
The hash code for this object.
no setterinherited
mergeHooks List<AccountMergeHandler>
Callbacks to merge data from additional modules or custom tables. These functions are invoked before any other special merge handlers.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

defaultCoreDataMergeHandler(Session session, {required UuidValue userToKeepId, required UuidValue userToRemoveId, required Transaction transaction}) Future<void>
Merges core Serverpod data from userToRemove to userToKeep.
defaultIdpMergeHandler(Session session, {required UuidValue userToKeepId, required UuidValue userToRemoveId, required Transaction transaction}) FutureOr<void>
Default merge handler that loops over Idps which support merging accounts and calls their individual merging functions.
defaultMergeCleanupHandler(Session session, {required UuidValue userToKeepId, required UuidValue userToRemoveId, required Transaction transaction}) FutureOr<void>
Default merge handler that deletes the old account.
defaultMergeHandler(Session session, {required UuidValue userToKeepId, required UuidValue userToRemoveId, required Transaction transaction}) FutureOr<void>
Default merge handler that throws an exception. This is only useful for applications which will never merge accounts.