createSession function
Implementation
Future<void> createSession(
String sessionId, ApplicationId appId, String providerId) async {
try {
final response =
await http.post(Uri.parse('$BACKEND_BASE_URL/api/sdk/create-session/'),
headers: {'Content-Type': 'application/json'},
body: jsonEncode({
'sessionId': sessionId,
'appId': appId,
'providerId': providerId,
}));
if (response.statusCode != 201) {
throw CreateSessionError(
'Error creating session with sessionId: $sessionId');
}
final res = json.decode(response.body);
return res;
} catch (err) {
rethrow;
}
}