Coder Social home page Coder Social logo

path null about flutter_file_picker HOT 16 CLOSED

Gagandeep1408 avatar Gagandeep1408 commented on June 12, 2024
path null

from flutter_file_picker.

Comments (16)

MohsinP07 avatar MohsinP07 commented on June 12, 2024

Hey @Gagandeep1408, Are you getting the permission error as well? I am getting same for Android 13.

from flutter_file_picker.

Gagandeep1408 avatar Gagandeep1408 commented on June 12, 2024

not permission error if you are getting permission error then add below permissions

for below 13

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

for 13 and above
 <uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO"/>
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO"/>



also make sure activity launch mode is singleTop.

            android:launchMode="singleTop"

from flutter_file_picker.

MohsinP07 avatar MohsinP07 commented on June 12, 2024

@Gagandeep1408 what if I want to pick excel file, is there any specific permission for that as well?

from flutter_file_picker.

Gagandeep1408 avatar Gagandeep1408 commented on June 12, 2024
                  FilePickerResult? result = await FilePicker.platform
                      .pickFiles(allowedExtensions: [
                    "m4a",
                    "mp3",
                    "ogg",
                    "wav",
                  ], type: FileType.custom);  

static List allowedDocumentExtensions() {
return [
'pdf',
'doc',
'zip',
'ppt',
'jpg',
'jpeg',
'gif',
'png',
'eps',
'HEIF',
'HEVC',
'docs',
'docx',
'doc',
'pptx',
'ppt',
'm4a',
'mp3',
'ogg',
'wav',
'mp4',
'mkv',
'm4v',
'mov',
'xlsx',
'xls',
'xlsb'
];
}

from flutter_file_picker.

MohsinP07 avatar MohsinP07 commented on June 12, 2024

Will the permissions you suggested also work for files with this extension @Gagandeep1408 ?
which are

for 13 and above
 <uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO"/>
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO"/>

from flutter_file_picker.

Gagandeep1408 avatar Gagandeep1408 commented on June 12, 2024

Will the permissions you suggested also work for files with this extension @Gagandeep1408 ? which are

for 13 and above
 <uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO"/>
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO"/>

Yes

from flutter_file_picker.

MohsinP07 avatar MohsinP07 commented on June 12, 2024

But still not working in my case for Android 13 @Gagandeep1408 .

from flutter_file_picker.

Gagandeep1408 avatar Gagandeep1408 commented on June 12, 2024

Did you check your manifest file?

Make sure your android:launchMode="singleTask".

from flutter_file_picker.

MohsinP07 avatar MohsinP07 commented on June 12, 2024

@Gagandeep1408 Yes i did change in the manifest file as you suggested its its not working
here is what i changed:
android:launchMode="singleTask"

it was "singleTop" before.

from flutter_file_picker.

Gagandeep1408 avatar Gagandeep1408 commented on June 12, 2024

Share the code to open file picker

from flutter_file_picker.

MohsinP07 avatar MohsinP07 commented on June 12, 2024

Hey @Gagandeep1408 Here it is
FilePickerResult? result =
await FilePicker.platform.pickFiles(
type: FileType.custom,
allowedExtensions: ['xlsx'],
);
if (result != null) {
File file = File(result.files.single.path!);
setState(() {
print(file.path);
filePath = file.path;
});

from flutter_file_picker.

Gagandeep1408 avatar Gagandeep1408 commented on June 12, 2024

which flutter version are you using?

from flutter_file_picker.

MohsinP07 avatar MohsinP07 commented on June 12, 2024

Version: 3.7.10

from flutter_file_picker.

MohsinP07 avatar MohsinP07 commented on June 12, 2024

Hey @Gagandeep1408 any solutions?

from flutter_file_picker.

MohsinP07 avatar MohsinP07 commented on June 12, 2024

Hey @Gagandeep1408 Did you solved anything related to this ?

from flutter_file_picker.

Gagandeep1408 avatar Gagandeep1408 commented on June 12, 2024

No i did not get this issue after change android:launchMode="singleTask"

from flutter_file_picker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.