file_manager
file_manager copied to clipboard
A ValueNotifier<String> was used after being disposed.
Error : A ValueNotifier<String> was used after being disposed.
Expanded( child: FileManager( controller: controller2, builder: (context, snapshot) { final List<FileSystemEntity> entities = snapshot; return GridView.builder( gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 3, crossAxisSpacing: 8.0, mainAxisSpacing: 8.0, ), itemCount: entities.length, itemBuilder: (context, index) { return Card( color: Colors.black, child: InkWell( onTap: () { if (FileManager.isDirectory( entities[index])) { controller2 .openDirectory(entities[index]); } else if (isVideoFile(entities[index])) { Navigator.push( context, MaterialPageRoute( builder: (context) => ChewieVideoPlayer( videoPath: entities[index].path, ), ), ); } else {} }, child: Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ FileManager.isFile(entities[index]) ? const Icon(Icons.feed_outlined, color: Colors.black) : Image.asset( 'assets/icons/folder_icons.png', width: 48, height: 48, ), const SizedBox(height: 8), Flexible( child: Text( FileManager.basename(entities[index]), style: const TextStyle( color: Colors.white), textAlign: TextAlign.center, ), ), ], ), ), ); }, ); }, ), )
Help me on this
I ran into the same issue. It was because I was disposing of the controller myself. The FileManager widget already disposes it for you. In my opinion, if the controller is exposed to the user, it should be up to them to dispose it, not the library. However, that's not how it was written.