mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 13:58:47 +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 {
|
||||
|
||||
@@ -6,12 +6,15 @@ PODS:
|
||||
- FlutterMacOS
|
||||
- url_launcher_macos (0.0.1):
|
||||
- FlutterMacOS
|
||||
- window_size (0.0.2):
|
||||
- FlutterMacOS
|
||||
|
||||
DEPENDENCIES:
|
||||
- file_selector_macos (from `Flutter/ephemeral/.symlinks/plugins/file_selector_macos/macos`)
|
||||
- FlutterMacOS (from `Flutter/ephemeral`)
|
||||
- menubar (from `Flutter/ephemeral/.symlinks/plugins/menubar/macos`)
|
||||
- url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`)
|
||||
- window_size (from `Flutter/ephemeral/.symlinks/plugins/window_size/macos`)
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
file_selector_macos:
|
||||
@@ -22,13 +25,16 @@ EXTERNAL SOURCES:
|
||||
:path: Flutter/ephemeral/.symlinks/plugins/menubar/macos
|
||||
url_launcher_macos:
|
||||
:path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos
|
||||
window_size:
|
||||
:path: Flutter/ephemeral/.symlinks/plugins/window_size/macos
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
file_selector_macos: ff6dc948d4ddd34e8602a1f60b7d0b4cc6051a47
|
||||
file_selector_macos: f1b08a781e66103e3ba279fd5d4024a2478b3af6
|
||||
FlutterMacOS: 57701585bf7de1b3fc2bb61f6378d73bbdea8424
|
||||
menubar: 4e3d461d62d775540277ce6639acafe2a111a231
|
||||
url_launcher_macos: 45af3d61de06997666568a7149c1be98b41c95d4
|
||||
url_launcher_macos: 597e05b8e514239626bcf4a850fcf9ef5c856ec3
|
||||
window_size: 339dafa0b27a95a62a843042038fa6c3c48de195
|
||||
|
||||
PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c
|
||||
|
||||
COCOAPODS: 1.11.2
|
||||
COCOAPODS: 1.11.3
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -6,12 +6,15 @@ PODS:
|
||||
- FlutterMacOS
|
||||
- url_launcher_macos (0.0.1):
|
||||
- FlutterMacOS
|
||||
- window_size (0.0.2):
|
||||
- FlutterMacOS
|
||||
|
||||
DEPENDENCIES:
|
||||
- file_selector_macos (from `Flutter/ephemeral/.symlinks/plugins/file_selector_macos/macos`)
|
||||
- FlutterMacOS (from `Flutter/ephemeral`)
|
||||
- menubar (from `Flutter/ephemeral/.symlinks/plugins/menubar/macos`)
|
||||
- url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`)
|
||||
- window_size (from `Flutter/ephemeral/.symlinks/plugins/window_size/macos`)
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
file_selector_macos:
|
||||
@@ -22,13 +25,16 @@ EXTERNAL SOURCES:
|
||||
:path: Flutter/ephemeral/.symlinks/plugins/menubar/macos
|
||||
url_launcher_macos:
|
||||
:path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos
|
||||
window_size:
|
||||
:path: Flutter/ephemeral/.symlinks/plugins/window_size/macos
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
file_selector_macos: ff6dc948d4ddd34e8602a1f60b7d0b4cc6051a47
|
||||
file_selector_macos: f1b08a781e66103e3ba279fd5d4024a2478b3af6
|
||||
FlutterMacOS: 57701585bf7de1b3fc2bb61f6378d73bbdea8424
|
||||
menubar: 4e3d461d62d775540277ce6639acafe2a111a231
|
||||
url_launcher_macos: 45af3d61de06997666568a7149c1be98b41c95d4
|
||||
url_launcher_macos: 597e05b8e514239626bcf4a850fcf9ef5c856ec3
|
||||
window_size: 339dafa0b27a95a62a843042038fa6c3c48de195
|
||||
|
||||
PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c
|
||||
|
||||
COCOAPODS: 1.11.2
|
||||
COCOAPODS: 1.11.3
|
||||
|
||||
Reference in New Issue
Block a user