我正在向Photo API发出http GET请求。它需要GoogleSignInAccount authHeaders。它适用于Flutter。
我正在尝试使其适用于Flutter_web。我使用flutter_web包并获取UserCredential。不确定如何从UserCredential获取authHeaders。
GoogleSignInAccount currentUser;
/* currentUser populate in Auth code */
Future<Map<String, String>> get authHeaders => currentUser.authHeaders;
Future<BuiltList<Album>> loadAlbumList() async {
var url =
'https://photoslibrary.googleapis.com/v1/albums?pageSize=50&excludeNonAppCreatedData=false';
Response response = await http.get(url, headers: await authHeaders);
if (response.statusCode != 200) {
print('LOG ERROR43');
}
var listAlbumsResponse = serializers.deserializeWith(
ListAlbumsResponse.serializer, jsonDecode(response.body));
return listAlbumsResponse.albums;
}
不适用