Answers for "how to download an image to device in flutter"

4

image from internet flutter

Image.network(
  'https://picsum.photos/250?image=9',
)
Posted by: Guest on August-01-2020
0

flutter image downloader

$ flutter pub add image_downloader

dependencies:
  image_downloader: ^0.31.0

import 'package:image_downloader/image_downloader.dart';

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

try {
  // Saved with this method.
  var imageId = await ImageDownloader.downloadImage("https://raw.githubusercontent.com/wiki/ko2ic/image_downloader/images/flutter.png");
  if (imageId == null) {
    return;
  }

  // Below is a method of obtaining saved image information.
  var fileName = await ImageDownloader.findName(imageId);
  var path = await ImageDownloader.findPath(imageId);
  var size = await ImageDownloader.findByteSize(imageId);
  var mimeType = await ImageDownloader.findMimeType(imageId);
} on PlatformException catch (error) {
  print(error);
}
Posted by: Guest on January-05-2022

Code answers related to "how to download an image to device in flutter"

Code answers related to "Dart"

Browse Popular Code Answers by Language