register method
Implementation
Future<Map<String, dynamic>?> register(
String username, String email, String name, String password) async {
var body = {
'username': username,
'email': email,
'name': name,
'password': password,
"honor_code": "true",
"is_authn_mfe": "true"
};
String formData = body.keys
.map((key) =>
"${Uri.encodeComponent(key)}=${Uri.encodeComponent(body[key].toString())}")
.join("&");
final response = await http.post(
Uri.parse('$edxBaseUrl/api/user/v2/account/registration/'),
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: formData,
);
var data = json.decode(response.body);
return data; // Return null if redirectUri is not in the response or token is not found
}