Home > Software design >  How to remove "image_picker" mark when select image using Image Picker flutter
How to remove "image_picker" mark when select image using Image Picker flutter

Time:10-23

I have this image picker But when picked the image It shows the "image_pick" mark in front of the image file Like this image_picker5431631000176511341.jpg But I want to remove it How can I do that is it possible?

code:

//Pick image
ElevatedButton(
         onPressed: () => selectFile(),
         child: const Text(
         'Select Image /Gallery'),
        ),

//Show fileName
Text('$fileName')


//To pick image
  void selectFile() async {
    final XFile? results = await picker.pickImage(source: ImageSource.gallery);

    if (results != null) {
      path = results.path;

      fileName = results.name;
      setState(() {});
      print(fileName);
    } else {
      print('No image picked');
    }
    setState(() {
      imageFile = File(results!.path);
    });
  }

Image:

remove the "image_picker" mark in front of the actual file name

CodePudding user response:

change to this

fileName = results.name.replace("image_picker","");
  • Related