Closed orestesgaolin closed 4 years ago
Apparently a kind of limitation (actually, a stricter syntax) introduced by EcmaScript 6. Basically, JavaScript now has strict rules about not allowing classes to be declared twice, which is rather normal in itself. But while Flutter hot reload certainly does some magic under the hood to work around this problem for itself, I'm not sure it's available to a plugin. Actually, right now I don't even know how they do it themselves (it's not sure they actually use ES6 anywhere, though). :-)
@orestesgaolin Please, check this. I'm aware of the Bad state: Future already completed error, it seems to be a recurring Flutter error, annoying but harmful, cropping up quite often on hot reload in many scenarios.
Hey, thanks for letting me know. I used the current master and indeed the previous error is gone and now I see following:
I can't seem to be able to reproduce this. Debug or release? First run or reload?
html.window.addEventListener('flutter_dropzone_web_ready', (_) {
if (!_readyCompleter.isCompleted) _readyCompleter.complete(true);
});
It appears to be the same error as yours. Checking for the completer seems to solve the issue
Oh, the bad future state? Then it might even be fixable, after all...? :-)
The callback was called three times in my case, I don't know why. I'm not sure if that's enough to fix but this simple change gets rid of the exception
You must be right. I saw this error in so many places with so many different plugins that I just accepted it as a Flutter problem and never actually checked it in detail.
Then if it's really all right, I might just as well send it to Pub.
After adding the DropZone and pressing CMD+S following error appears:
Sample code:
Flutter 1.19.0-5.0.pre Chrome 83.0.4103.106 on macOS