signup method

  1. @override
Future<LoginUser?> signup(
  1. String username,
  2. String countryCode,
  3. String contact,
  4. ContactType contactType,
  5. String verifyCode,
  6. String password, {
  7. HandleError? onError,
})
override

Implementation

@override
Future<LoginUser?> signup(
  String username,
  String countryCode,
  String contact,
  ContactType contactType,
  String verifyCode,
  String password, {
  HandleError? onError,
}) async {
  var res = await helper.post(
    '/signup',
    data: {
      "name": username,
      "contact": contact,
      "country_code": countryCode,
      "contact_type": contactTypes[contactType],
      "verify_code": verifyCode,
      "password": password,
    },
    showError: onError,
  );
  if (res == false) {
    return null;
  }
  return LoginUser(
    token: res['data']['token'],
    user: User.fromJson(res['data']['user']),
  );
}