toInterface static method

ProfileInterface toInterface(
  1. Profile profile
)

convert a Profile to a ProfileInterface

Implementation

static ProfileInterface toInterface(
  Profile profile,
) {
  final loginSummary = profile.loginSummary;
  final emails = profile.emails;

  return ProfileInterface(
    uid: profile.uid,
    givenName: profile.givenName,
    middleName: profile.middleName,
    familyName: profile.familyName,
    name: profile.name,
    nickname: profile.nickname,
    birthdate: profile.birthdate,
    profileURL: profile.profileURL,
    picture: profile.picture,
    externalId: profile.externalId,
    authTypes: profile.authTypes,
    loginSummary: loginSummary != null
        ? LoginSummaryConverter.toInterface(loginSummary)
        : null,
    username: profile.username,
    gender: profile.gender,
    email: profile.email,
    emailVerified: profile.emailVerified,
    emails: emails != null ? EmailsConverter.toInterface(emails) : null,
    phoneNumber: profile.phoneNumber,
    phoneNumberVerified: profile.phoneNumberVerified,
    addresses:
        profile.addresses?.map(ProfileAddressConverter.toInterface).toList(),
    locale: profile.locale,
    bio: profile.bio,
    customFields: profile.customFields,
    consents: profile.consents?.map(
      (key, consent) => MapEntry(key, ConsentConverter.toInterface(consent)),
    ),
    createdAt: profile.createdAt,
    updatedAt: profile.updatedAt,
    liteOnly: profile.liteOnly,
    company: profile.company,
  );
}