logout method
Session destruction and logout.
Implementation
Future<void> logout() async {
final response = await _client.post(
Uri.https(
'eclass.$instituteId.gr',
'/modules/mobile/mlogin.php',
),
body: {
'token': _token ?? '',
'logout': '',
},
);
if (response.statusCode != 200 || response.body != 'OK') {
throw Exception('Failed to logout.');
}
_client.close();
}