dropzone
dropzone copied to clipboard
DropZone does not work After Hot Restart
When using a DropZone
widget in a Flutter web app and using hot restart, the drop zone will stop working.
I investigated this and found out that the old listener is called instead of the new one after hot restart, i.e. the listener attached to the JS drop events survives the hot restart and no new listener is attached.
@Derrick56007 do you have an idea how to fix this?
hi @creativecreatorormaybenot
Could you post your code?
Also what was your expected vs actual result?
@Derrick56007
Color _color = Colors.white;
@override
Widget build(BuildContext context) {
return DropZone(
onDragEnter: () => setState(() => _color = Colors.green),
onDragExit: () => setState(() => _color = Colors.white),
child: ColoredBox(
color: _color,
child: const SizedBox.expand(),
),
);
}
Replace this with the default Flutter template app.
Expected result:
- Run app.
- Drag file hover it over the area, then drag out again.
- → turns green, turns white.
- Hot restart app.
- Drag file hover it over the area, then drag out again.
- → turns green, turns white.
Actual result:
- Run app.
- Drag file hover it over the area, then drag out again.
- → turns green, turns white.
- Hot restart app.
- Drag file hover it over the area, then drag out again.
- → nothing happens.
Facing the same issue here, even in release build of the application when the app is refreshed it throws "Render box not laid out"