如何使用Flutter从Facebook Graph API获取更好的个人资料图片



我使用http.get获得了用户的fb个人资料图片,但是图片很小且模糊,如何获得更好的图片?目前,这是我获取图像并存储它的代码:

final token = result.accessToken.token;
                          final graphResponse = await http.get('https://graph.facebook.com/v3.3/me?fields=name,picture,friends,email&access_token=${token}');
                          final profile = JSON.jsonDecode(graphResponse.body);
                          print(profile);
                          setState(() {
                            userProfile = profile;
                            _isLoggedIn = true;
                          });

然后,当我在DB中设置数据时:

'photoUrl':userProfile["picture"]["data"]["url"],

图片非常小且模糊,因为我在URL IDK内获得50的宽度和高度如何更改?

请参阅下面的示例URL,该URL指定尺寸。

final graphResponse = await http.get(
    'https://graph.facebook.com/v2.12/me?fields=name,picture.width(800).height(800),first_name,last_name,email&access_token=${fbToken}');

这确实是一个FB图API问题,此前已在这里回答:获取全尺寸的个人资料图片

最新更新