User constructor

User(
  1. String id, {
  2. String? membership,
  3. String? displayName,
  4. String? avatarUrl,
  5. required Room room,
})

Implementation

factory User(
  String id, {
  String? membership,
  String? displayName,
  String? avatarUrl,
  required Room room,
}) {
  return User.fromState(
    stateKey: id,
    senderId: id,
    eventId: 'fake_event',
    content: {
      if (membership != null) 'membership': membership,
      if (displayName != null) 'displayname': displayName,
      if (avatarUrl != null) 'avatar_url': avatarUrl,
    },
    typeKey: EventTypes.RoomMember,
    room: room,
    originServerTs: DateTime.now(),
  );
}