createUser method

  1. @override
Future<Response> createUser(
  1. String name,
  2. String email,
  3. String password
)
override

Creates a user in the service with the arguments name, email and password

Implementation

@override
Future<Response> createUser(String name, String email, String password) {
  if (name.isEmpty ||
      email.isEmpty ||
      password.isEmpty ||
      !EmailValidator.validate(email)) {
    throw Exception(
        'The arguments must be not empty and the e-mail must be valid');
  } else {
    if (password.length < 8) {
      throw Exception('The password must have at least eight characters');
    } else {
      return _service.createUser(name, email, password);
    }
  }
}