📜  飞镖语言异步?? - 飞镖代码示例

📅  最后修改于: 2022-03-11 14:48:04.795000             🧑  作者: Mango

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

...

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