Skip to content

Create User with Username and Password Only  #465

@podcoder

Description

@podcoder

I would like to signup a user with username and password only.
But, if I extend the ParseUser class, I need to pass three parameters i.e username, password and email.

class TestUser extends ParseObject implements ParseCloneable {
  TestUser() : super("_User");
  TestUser.clone() : this();

  @override
  TestUser clone(Map<String, dynamic> map) => TestUser.clone()..fromJson(map);

  static const String keyUsername = "username";
  static const String keyPassword = "password";

  String get username => get<String>(keyUsername);
  set username(String username) => set<String>(keyUsername, username);

  String get password => get<String>(keyPassword);
  set password(String password) => set<String>(keyPassword, password);
}

I was able to achieve the functionality I want as follow:

  Future _createUser() async {
    var user = TestUser()..set('username', 'sky12')..set('password', '123456');
    await user.save();
  }

I was wondering if there is a better approach to accomplish this task by extending ParseUser class. Because it will enable me to take full advantages of already implement functionalities.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions