fetchSessionDataFromApi method

Future<String> fetchSessionDataFromApi(
  1. String token
)

Implementation

Future<String> fetchSessionDataFromApi(String token) async {
  try {
    final response = await http.get(Uri.parse(_baseUrl));
    if (response.statusCode == 200) {
      return response.body;
    } else {
      throw Exception('Failed to load session data');
    }
  } catch (e) {
    throw Exception('Failed to connect to the server');
  }
}