DevsOnFlutter / file_manager

FileManager is a wonderful widget that allows you to manage files and folders, pick files and folders, and do a lot more. Designed to feel like part of the Flutter framework.
https://pub.dev/packages/file_manager
BSD 3-Clause "New" or "Revised" License
61 stars 18 forks source link

Error when access to files #10

Open gustavomrfz opened 2 years ago

gustavomrfz commented 2 years ago

Description

Using example sample pasted at main.dart. With a Blackview phone with external storage:

The following assertion was thrown while dispatching notifications for ValueNotifier<String>:
setState() or markNeedsBuild() called during build.

This ValueListenableBuilder<String> widget cannot be marked as needing to build because the framework is already in the process of building widgets.  A widget can be marked as needing to be built during the build phase only if one of its ancestors is currently building. This exception is allowed because the framework builds parent widgets before children, which means a dirty descendant will always be built. Otherwise, the framework might not visit this widget during this build phase.

The widget on which setState() or markNeedsBuild() was called was: ValueListenableBuilder<String>
    state: _ValueListenableBuilderState<String>#6367a
The widget which was currently being built when the offending call was made was: FutureBuilder<List<Directory>?>
    dirty
    state: _FutureBuilderState<List<Directory>?>#4c501

The line that fails at file_manager.dart is:

final List<FileSystemEntity> list = await Directory(path).list().toList();

Storage permissions are given.

Logs

$ flutter analyze
Analyzing filemanager...                                                
No issues found! (ran in 3.7s)
$ flutter doctor -v
[✓] Flutter (Channel stable, 2.2.3, on Linux, locale es_ES.UTF-8)
    • Flutter version 2.2.3 at /home/user/SDK/flutter
    • Framework revision f4abaa0735 (hace 9 semanas), 2021-07-01 12:46:11 -0700
    • Engine revision 241c87ad80
    • Dart version 2.13.4

[!] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /home/user/Android/Sdk
    • Platform android-31, build-tools 31.0.0
    • Java binary at: /opt/android-studio-2020.3.1/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/linux#android-setup for more details.

[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✓] Android Studio (version 2020.3)
    • Android Studio at /opt/android-studio-2020.3.1/android-studio
    • Flutter plugin version 59.0.2
    • Dart plugin version 203.8292
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[✓] Android Studio
    • Android Studio at /opt/android-studio
    • 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 11.0.10+0-b96-7249189)

[✓] VS Code (version 1.59.1)
    • VS Code at /usr/share/code
    • Flutter extension version 3.26.0

[✓] Connected device (1 available)
    • BV4900Pro (mobile) • BV4900EEA000xxxxxx • android-arm64 • Android 10 (API 29)

! Doctor found issues in 2 categories.

Works fine on emulator with Android 10

FaizanKamal7 commented 2 years ago

Did you find a way to fix that?