getContent method
Implementation
Future<Map<String, dynamic>?> getContent({
required String accesstoken,
required String userid,
List<String>? fields,
}) async {
try {
String scopes = '';
if (fields != null) {
scopes = fields.join(',');
} else {
scopes = 'media_count,account_type';
}
final response = await http.get(
Uri.parse(
'https://graph.instagram.com/$userid?fields=$scopes&access_token=$accesstoken',
),
);
final body = jsonDecode(response.body);
debugPrint('body: $body');
return body;
} catch (e) {
debugPrint('Error: $e');
throw Exception(e);
}
}