Future Get Result In Flutter

Future Get Result In Flutter :

This flutter tutorial post is Future return data, that data use flutter application. That commonly use common class.

Future Get Result In Flutter
Future<File> getImage()  async {
  var image = await ImagePicker.pickImage(source: ImageSource.camera);
  var result = await FlutterImageCompress.compressAndGetFile(
      image.absolute.path, image.absolute.path,
      quality: 50);

  return result;
}

//Future get the data
Future<File> image = getImage();
   image.then((data) {
   var fileBytes = new File(data.path).readAsBytesSync();
   String encodedFile = base64.encode(fileBytes);
   setState(() {
    File _image = data;
   });
  }, onError: (e) {
});

The flutter tutorial  is a website that bring you the latest and amazing resources of code. All the languages codes are included in this website. The languages like flutter, android, java,kotlin etc.with the help of this languages any user can develop the beautiful application

For more information about Flutter. visit www.fluttertutorial.in