createUser method
Create a new user
email The email of the user
password The password of the user
name The name of the user
role The role of the user
data Any additional data to be stored in the user
Implementation
Future<CreateUserResponse<T>> createUser({
required String email,
required String password,
required String name,
String? role,
Map<String, dynamic>? data,
}) async {
try {
final response = await super.dio.post(
"/admin/create-user",
data: {
"email": email,
"password": password,
"name": name,
"role": role,
"data": data,
}..removeWhere((key, value) => value == null),
options: await super.getOptions(isTokenRequired: true),
);
return CreateUserResponse<T>.fromJson(response.data, super.fromJsonUser);
} catch (e) {
final message = getErrorMessage(e);
if (message == null) rethrow;
throw message;
}
}