updateEmail method

  1. @override
Future<Response> updateEmail(
  1. String email,
  2. String newEmail,
  3. String jwt
)
override

Updates the user email to newEmail

Implementation

@override
Future<Response> updateEmail(String email, String newEmail, String jwt) {
  if (email.isEmpty || newEmail.isEmpty || jwt.isEmpty) {
    throw Exception('All data must be provided');
  }
  if (!EmailValidator.validate(email) || !EmailValidator.validate(newEmail)) {
    throw Exception('E-mail must be valid');
  }
  return _service.updateEmail(email, newEmail, jwt);
}