0

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.

sameera lakshitha
  • 1,925
  • 4
  • 21
  • 29

1 Answers1

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