signUp method

  1. @override
Future<ThirdPartySessionModel> signUp(
  1. String mail,
  2. String pass,
  3. String name
)
override

Implementation

@override
Future<ThirdPartySessionModel> signUp(
    String mail, String pass, String name) async {
  try {
    var data = await this.api.signUp(mail, pass);

    // DATA
    if (data != null) {
      String? token = await data.getIdToken(true);

      if (!data.emailVerified) {
        await this.api.sendEmail();
      }

      return ThirdPartySessionModel(
        token: token!,
        display: data.displayName,
        mail: data.email,
        pic: data.photoURL,
        mailValidationDone: data.emailVerified,
      );

      // NO DATA
    } else {
      throw Exception();
    }
  } on PlatformException catch (pe) {
    ModLogger.e(tag: TAG, msg: "${pe.toString()}", error: pe);
    throw pe;
  } on Exception catch (e) {
    ModLogger.e(tag: TAG, msg: "${e.toString()}", error: e);
    throw ModDataException();
  }
}