The return type 'QuerySnapshot' isn't a 'Future<Iterable<_>>', as required by the closure's context. code example

Example: future as a parameter with async in flutter

FloatingActionButton(
  onPressed: () => getImageFromCam(index),
  tooltip: 'Pick Image',
  child: Icon(Icons.add_a_photo),
);

...

Future<void> getImageFromCam(int index) async {
  // Do whatever you want with `index`.
  final image = await ImagePicker.pickImage(source: ImageSource.camera);
  setState(() => _image = image);
}

Tags:

Dart Example