I need to extract some random images from gallery without the picker option. Please be clear that I don't want to open picker for this, just extract images if user tapped the button.
Asked
Active
Viewed 576 times
1 Answers
0
You could use dart:io to get the files in a directory and display one of the image files in the directory.
import 'dart:io' as io;
var files = io.Directory("/storage/emulated/0/DCIM/Camera").listSync();
final _random = new math.Random();
var idx= _random.nextInt(files.length) ;
var file = files[idx];
//TODO display the file.

ZPrime
- 393
- 4
- 8
-
i want to get some random photos from the gallery and upload to firebase storage. so i just need to have an array of random photos or video from gallery. – MALIKK HABIB UR REHMAN Jan 28 '20 at 06:40