load static method

Future<Uint8List?> load(
  1. String? url, {
  2. Client? client,
})

Loads the images bytes for given url from Giphy.

Implementation

static Future<Uint8List?> load(String? url, {Client? client}) async {
  if (url == null) {
    return null;
  }
  final response = await (client ?? Client())
      .get(Uri.parse(url), headers: {'accept': 'image/*'});

  if (response.statusCode == 200) {
    return response.bodyBytes;
  }
  return null;
}