MixinNetwork / MixinNetwork/flutter-plugins
Listener will be binded twice while its parent rebuild
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 512
- Forks
- 292
- Avg merge
- 15h 8m
- Merged PRs (30d)
- 7
Description
class FileDropBox extends StatelessWidget {
FileDropBox({super.key});
final controller = Get.put(FileDropController());
@override
Widget build(BuildContext context) {
return DropTarget(
onDragDone: (details) {
final paths = details.files.map((file) => file.path).toList();
debugPrint("onDragDone!!!");
controller.onFilesDropped(paths);
},
child: const SizedBox.expand(),
);
}
}
For example, when the stateless widget FileDropBox rebuild, DropTarget will add a new onDragDone listener.
Which Means when I drop file to this widget, it will run onDragDone twice.
When FileDropBox rebuild again, onDragDone will run for three times.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start from the FileDropBox example and inspect DropTarget's listener lifecycle, especially how its onDragDone callback is registered when the parent rebuilds. Reproduce the example across rebuilds and verify that dropping a file invokes the callback only once, then check the relevant plugin tests if available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart
- Domain
- desktop-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100