flutter convert pickedfile to file code example

Example 1: info: 'pickImage' is deprecated and shouldn't be used. Use imagePicker.getImage() method instead.. (deprecated_member_use at [totem_service_app] lib/ui_screens/Work Order Report Screen.dart:274)

PickedFile imageFile;Future getImage(int type) async {  PickedFile pickedImage = await ImagePicker().getImage(      source: type == 1 ? ImageSource.camera : ImageSource.gallery,      imageQuality: 50);  return pickedImage;}

Example 2: info: 'pickImage' is deprecated and shouldn't be used. Use imagePicker.getImage() method instead.. (deprecated_member_use at [totem_service_app] lib/ui_screens/Work Order Report Screen.dart:274)

new ListTile(    leading: new Icon(      Icons.photo_library,    ),    title: new Text(      'Galary',    onTap: () async {      final tmpFile = await getImage(2);      setState(() {        imageFile = tmpFile;      });    }),

Example 3: info: 'pickImage' is deprecated and shouldn't be used. Use imagePicker.getImage() method instead.. (deprecated_member_use at [totem_service_app] lib/ui_screens/Work Order Report Screen.dart:274)

Expanded(  child: Container(    decoration: BoxDecoration(        image: DecorationImage(            image: imageFile == null                ? AssetImage('assets/illustrations/name_contact.png')                : FileImage(File(imageFile.path)),            fit: BoxFit.cover)),  ),),

Tags:

Misc Example