downloadImage method

Future downloadImage(
  1. String url,
  2. String localPath
)

Implementation

Future<dynamic> downloadImage(String url, String localPath) async {
  File(localPath).createSync(recursive: true);
  File file = File(localPath);
  var bytes = await _getImageBytes(url);
  await file.writeAsBytes(bytes);
  return bytes;
}