convert future string to string flutter code example

Example 1: convert to string flutter

int intValue = 1;
  String stringValue = intValue.toString();
  String hexValue = intValue.toRadixString(16);

Example 2: 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:

Misc Example