fetchPhotos method

Future<PhotoPaging> fetchPhotos (
  1. Album album,
  2. [String nextUrl]
)

Implementation

Future<PhotoPaging> fetchPhotos(Album album, [String nextUrl]) async {
  String url = nextUrl ??
      '$_graphApiEndpoint/${album.id}/photos?access_token=$_accessToken&fields=id,name,width,height,photo,source&format=json';
  http.Response response = await http.get(Uri.parse(url));
  Map<String, dynamic> body = json.decode(response.body);

  if (response.statusCode != 200) {
    throw GraphApiException(body['error']['message'].toString());
  }

  return PhotoPaging.fromJson(body);
}