mirror of
https://github.com/flutter/samples.git
synced 2026-05-13 10:27:09 +00:00
Simplify Unsplash response handling (#1077)
This commit is contained in:
@@ -72,12 +72,7 @@ class Unsplash {
|
||||
throw UnsplashException(apiError.errors!.join(', '));
|
||||
}
|
||||
|
||||
return SearchPhotosResponse.fromJson(
|
||||
// Per Response#body, if the Content-Type header is unknown, bodyBytes
|
||||
// is interpreted as latin1. Unsplash returns utf8, but with no encoding
|
||||
// specified in the Content-Type, so we must do it ourselves.
|
||||
utf8.decode(response.bodyBytes),
|
||||
);
|
||||
return SearchPhotosResponse.fromJson(json.encode(body));
|
||||
}
|
||||
|
||||
Future<Uint8List> download(Photo photo) async {
|
||||
|
||||
Reference in New Issue
Block a user