Skip to content

[Bug]onFileLoading callback from pickFiles() incorrectly triggered by saveFile() in file_picker plugin on Android #1918

@KS6281

Description

@KS6281

The onFileLoading callback provided to FilePicker.platform.pickFiles() is unexpectedly triggered when saving files using FilePicker.platform.saveFile(), especially after a file has already been picked. This occurs when selecting any directory in Google Drive and saving a file.

Platform

  • Android
  • iOS
  • Web
  • Desktop

Platform OS version
What version did it happen?
NA

How are you picking?
NA

Details to reproduce the issue
Provide all the details to reproduce the issue.

  1. Call FilePicker.platform.pickFiles() with the onFileLoading callback to open the internal file picker.
  2. After picking a file, call FilePicker.platform.saveFile() to open the internal file picker for saving a file.
  3. Once the file is saved, the previously provided onFileLoading callback is triggered again.

Expected Behavior
The onFileLoading callback should only be triggered for the active file picking operation and not when saving files via saveFile().
Actual Behavior
The onFileLoading callback from the previous pickFiles() call is triggered when saving a file using saveFile().

Error Log
NA

Screenshots and/or video
NA

Flutter Version details

[✓] Flutter (Channel stable, 3.24.3, on macOS 14.7.8 23H730 darwin-arm64, locale en-US)
    • Flutter version 3.24.3 on channel stable at /Users/ks6281/Documents/GitHub/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 2663184aa7 (1 year, 1 month ago), 2024-09-11 16:27:48 -0500
    • Engine revision 36335019a8
    • Dart version 3.5.3
    • DevTools version 2.37.3

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK at /Users/ks6281/Library/Android/sdk
    • Platform android-35, build-tools 35.0.0
    • ANDROID_HOME = /Users/ks6281/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16C5032a
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)

[✓] VS Code (version 1.104.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.112.0

[✓] VS Code (version 1.94.2)
    • VS Code at /Users/ks6281/Downloads/Visual Studio Code.app/Contents
    • Flutter extension version 3.112.0

[✓] Connected device (4 available)
    • Kavya (mobile)                  • 00008130-001E74AE11FA001C • ios            • iOS 18.6.2 22G100
    • macOS (desktop)                 • macos                     • darwin-arm64   • macOS 14.7.8 23H730 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad     • darwin         • macOS 14.7.8 23H730 darwin-arm64
    • Chrome (web)                    • chrome                    • web-javascript • Google Chrome 141.0.7390.66

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Additional context
This issue only occurs if FilePicker.platform.pickFiles() is called before saveFile().().

Metadata

Metadata

Assignees

No one assigned

    Labels

    new issueAn issue that hasn't yet been seen from the maintainer

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions