getUserData method

Future<Map<String, dynamic>?> getUserData()

Get the user data from the access token.

Implementation

Future<Map<String, dynamic>?> getUserData() async {
  try {
    response = await http.get(
      Uri.parse(userDataUrl),
      headers: {
        'Accept': 'application/json',
        'Authorization': "Bearer $accessToken",
      },
    );
    var userData = jsonDecode(response.body);
    return userData;
  } catch (e) {
    return null;
  }
}