retrieveLocationGallery static method

Future<List<GalleryItem>> retrieveLocationGallery(
  1. String locationId
)

Implementation

static Future<List<GalleryItem>> retrieveLocationGallery(String locationId) async {
  final List<GalleryItem> gallery = [];

  final res = await httpClient.get(Config.getURI('/locations/$locationId/gallery.json'));

  debugPrint('[DEBUG]: statusCode ${res.statusCode}');
  debugPrint('[DEBUG]: body ${res.body}');

  dynamic data = json.decode(res.body.toString());

  if (res.body.length > 14) {
    for (final item in data['gallery']) {
      gallery.add(GalleryItem.fromJson(item));
    }
  }
  return gallery;
}