networkImage function

Future<ImageProvider> networkImage(
  1. String url, {
  2. bool cache = true,
  3. Map<String, String>? headers,
  4. PdfImageOrientation? orientation,
  5. double? dpi,
  6. PdfBaseCache? pdfCache,
})

Download an image from the network.

Implementation

Future<ImageProvider> networkImage(
  String url, {
  bool cache = true,
  Map<String, String>? headers,
  PdfImageOrientation? orientation,
  double? dpi,
  PdfBaseCache? pdfCache,
}) async {
  pdfCache ??= PdfBaseCache.defaultCache;
  final bytes = await pdfCache.resolve(
    name: url,
    uri: Uri.parse(url),
    cache: cache,
    headers: headers,
  );

  return MemoryImage(bytes, orientation: orientation, dpi: dpi);
}