Skip to content

Commit 8c17c6a

Browse files
committed
error messages in auth service and verification
1 parent f4e1b6b commit 8c17c6a

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

lib/appwrite_service/auth_service.dart

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,16 @@ class AuthService extends ChangeNotifier {
6060
}
6161
}
6262

63-
Future<User> createUser({required String email, required String password}) async {
63+
Future<User?> createUser({required String email, required String password}) async {
6464
notifyListeners();
6565

6666
try {
67-
final user = await account.create(userId: ID.unique(), email: email, password: password, name: 'Sam Alt');
67+
final user = await account.create(userId: ID.unique(), email: email, password: password);
6868
return user;
69-
} finally {
70-
notifyListeners();
69+
} on AppwriteException catch (e) {
70+
print(e);
71+
UtilityHelper.toastMessage(message: e.message ?? "AuthService.components() null message");
72+
return null;
7173
}
7274
}
7375

@@ -119,12 +121,4 @@ class AuthService extends ChangeNotifier {
119121
notifyListeners();
120122
}
121123
}
122-
123-
Future<Preferences> getUserPreferences() async {
124-
return await account.getPrefs();
125-
}
126-
127-
updatePreferences({required String bio}) async {
128-
return account.updatePrefs(prefs: {'bio': bio});
129-
}
130124
}

0 commit comments

Comments
 (0)