Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A ValueNotifier<String> was used after being disposed. #31

Open
Adbhutashra opened this issue Jan 15, 2024 · 1 comment
Open

A ValueNotifier<String> was used after being disposed. #31

Adbhutashra opened this issue Jan 15, 2024 · 1 comment

Comments

@Adbhutashra
Copy link

Error : A ValueNotifier was used after being disposed.

Expanded(
child: FileManager(
controller: controller2,
builder: (context, snapshot) {
final List 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

@Colman
Copy link

Colman commented Sep 27, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants