sendEmailVerification method
Implementation
@override
Future<bool> sendEmailVerification({required String email}) async {
final MonitoringService monitoringService = core.get<MonitoringService>();
var trace =
await monitoringService.createTrace(name: 'sendEmailVerification');
trace.start();
try {
if (!isReady) {
throw LittlefishFirebaseAuthException('AUTH_INIT_000',
'$providerName: Firebase is not initialized, $providerName cannot send email verification');
}
if (kCurrentUser == null) {
throw LittlefishFirebaseAuthException('AUTH_002',
'$providerName: Current user is not available, $providerName cannot send email verification');
}
logger.info(
this,
"$providerName: Sending email verification to $email",
);
await kCurrentUser?.sendEmailVerification();
logger.info(
this,
"$providerName: Email verification sent to $email",
);
return true;
} on FirebaseAuthException catch (e) {
throw _handleFirebaseAuthException(e);
} catch (e) {
if (e is LittlefishException) {
rethrow;
}
throw LittlefishFirebaseAuthException(
'AUTH_014',
'An unexpected error occurred while sending email verification.',
cause: e,
);
} finally {
trace.stop();
}
}