changeId method

Future<void> changeId(
  1. String? id, {
  2. Map<String, Object?>? properties,
  3. Map<String, Object?>? data,
  4. Map<Type, String?>? overrideId,
  5. Map<Type, Map<String, Object?>>? overrideProperties,
})

Sets the user's id and various values.

Executing this function will discard the current values of User.properties.

With overrideId, you can override the id value in any Type. Overridden values can be retrieved using getIdFor.

With overrideProperties, you can override property values in any Type. Overridden values can be retrieved using getPropertiesFor.

Implementation

Future<void> changeId(
  String? id, {
  Map<String, Object?>? properties,
  Map<String, Object?>? data,
  Map<Type, String?>? overrideId,
  Map<Type, Map<String, Object?>>? overrideProperties,
}) async {
  await lock((batch) async {
    await changeIdWithBatch(
      batch: batch,
      id: id,
      properties: properties,
      data: data,
      overrideId: overrideId,
      overrideProperties: overrideProperties,
    );

    batch.commit();
  }, lockKey: _key);
}