Open Asad0473 opened 1 year ago
Could you come up with a reproducible repo?
what do you mean by reproducible repo?
A very small project, a minimal one, that shows the problem and allows me to reproduce it. Because, as things stand now, I can't make that error appear myself, so I have no idea what leads to it and how I can fix it.
@deakjahn , here is the sample project link. please download it and make it live on server. because we are getting target platform error on our live server. in local it's working fine. our app is developed for Android, IOS, and web. but this we allowing this feature is only for web . please make it supported for Window and MacOs as well. I think it might be creating problem because this library is not supporting Windows and MacOs.
https://drive.google.com/file/d/1644K50Sx_-imnKUYcEyqlJTj58xHXkCx/view?usp=sharing
@deakjahn We are working on a social media website called Werfie (https://werfie.com) which is similar to Twitter. We would love to dropzone developed by you in werfie. You will get credit for it as well in our website Credits section. I request you to please update us with the issue that we are facing while using dropzone in our website. We are expecting to launch the new version of werfie.com on Monday next week and this issue is holding the release. I request your immediate attention on this. waiting for your response...
@Asad0473 Then please, help me what to look for :-) I downloaded it, put it into Android Studio and built for the web. I uploaded it to my test site, temporarily at http://teszt.tramontana-teszt.hu/#/. When I start it, it starts, when I drag an image into it, it appears. I'm testing in Vivaldi, a Chrome based browser but I also tried Edge to be sure.
Its not working on my website
But does my test at the link above work for you, in your browser?
sorry its working fine in my browser
but its not work for https://werfie.com/ ..
Maybe its not working for secure website
I don't think so but I can add a cert to my test in a few minutes. In the meantime, could you do the same as I did? I built your sample simply with:
flutter build web
or
flutter build web --web-renderer canvaskit
and upload the contents of build/web
to anywhere on your site into a new folder that I can access from outside?
It's HTTPS now: https://teszt.tramontana-teszt.hu/#/
Ok i test it
I don't really know where you plan to use it on the site. In the dialog to send a post?
yes in dialog to post
Right now I get a window showing the image and the browser has CORS error messages. But nothing about Windows...
https://staging.werfie.com/ use this link and you see the error in post dialog
I tried with the real one, with a disposable e-mail, but didn't send any message. :-) I'll try to register the same here.
see this image @deakjahn
I can't register because I can't select a country, the dropdown doesn't open. It did all right on the real site, although it would be nice to have a way to use the keyboard to locate the country, there are quite a few on the Earth. ;-))
Can you see the above image ?
Yes, sure, but I'd like to see it in action so that I can look into the browser dev console.
OK, I saved it, you can delete the message.
Ok
I can see the message, but I don't yet know what Windows has to do with it. :-) There are Firebase errors in the console but that's something else.
Yes i know .. I also could not find that problem its working fine in debug mode and even android release mode.. But we go to live window error is coming. I think this libaray is not for windows thats why
It certainly isn't, it's a web only plugin, but we're on the web now. :-) Basically, this is a federated plugin. This means that it has a central interface and implementation for platforms. In this particular case, a single implementation, nothing else: web. All the others (Android, iOS, Linux, macOS, Web) are missing because there is no sense, of course. That means that the default interface itself throws this error for any implementation: https://github.com/deakjahn/flutter_dropzone/blob/master/flutter_dropzone_platform_interface/lib/method_channel_flutter_dropzone.dart
And then, the web implementation overrides it and does the actual work: https://github.com/deakjahn/flutter_dropzone/blob/master/flutter_dropzone_web/lib/flutter_dropzone_plugin.dart
So, this is the genuine error message that you should see on anything but the web. But even then, how come Flutter thinks it's running on Windows?
So what the solution is now ?
defaultTargetPlatform comes from the Flutter engine, package:flutter/foundation.dart
, Flutter fills it with the platform it thinks it runs on. What does it say when you start the program? Could you log it somewhere when you start running?
I dont see any error on log my log is clear
It's not necessarily important:
I think this is not related to this
No, certainly not.
By the way i used getmaterial from getx not material app
Well, I never did, I prefer my own classes for state management and cross platform widgets can also be done with other plugins. Can you experiment a little with this dialog? You could place a Text() anywhere and make it display this defaultTargetPlatform
. If it says windows, that would be very strange.
You know already do that.. I place it some other location but i got same error
Not a Dropzone, just a Text to see what defaultTargetPlatform says.
I do not understand what are you trying to say that
You have that dialog with the text field to type into, the avatar of the user, the Dropzone, icon buttons at the bottom. I would add a Text()
widget as well that shows the value of defaultTargetPlatform from foundation. Just for a minute, to see what is in this variable.
flutter build web --web-renderer html --release i run this command and its working fine now thanks for your time and effort . I really appreciateit :-)
OK, that's good to hear, a temporary relief but not the solution, unfortunately, because it should have no connection with that. I only use CanvasKit since it appeared (not even in stable, but already before that) because it provides much better performance and features than the old one. Even the test I put up yesterday was CanvasKit. So, this isn't the real solution, even if it now helps you. :-)
Had same issue.. flutter build web --web-renderer html --release did the trick.
For me it doesn't work and I AM using html as the web renderer. I am testing this on Linux.
And do you all have the problem in your own, fully developed app, or maybe we can create a minimal one that can be shared here? Because I'm yet to see it and this makes it awfully hard to diagnose... :-))
Switched to drop_zone, sorry.
I'm having the same problem. here is my code :
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('default Target Platform : $defaultTargetPlatform'),
const SizedBox(height: 10),
const Text('is Web : $kIsWeb'),
const SizedBox(height: 10),
if (kIsWeb)
DropzoneView(
onCreated: (controller) => dropCtrl = controller,
onDrop: (value) {
log(value.name);
},
),
],
),
but still havingdropzone view: targetplatform.windows is not supported
as output.
even though I'm on the web, defaultTargetPlatform is detecting windows cause I'm developing on windows?
@Ahnaf16
cause I'm developing on windows?
So do I and still I don't have the error. Strange. Yes, this shows Windows for me, too, but the drop still works all right. Anyway, I try to come up with a solution.
To put it into some perspective, we never actually check the platform, there's no decision based on that. Simply, this is a web plugin that has its implementation in flutter_dropzone_plugin.dart
. You only get this error message if, for some reason, it doesn't register and start the plugin. As I still can't trigger the error, could you help me a bit with this? This is how it works (or is supposed to work):
We have an abstract class and the static instance
is initialized with it:
But as soon as the real web plugin is registered, this instance
gets overwritten:
And from now on, any part that uses this instance will use the web plugin. You only get the error message if this registration doesn't work and the instance keeps the original value (where all functions lead to a very deliberate exception):
So, the question would be if you could debug this registerWith()
function, maybe with some log readouts, to see how far you can get in your code.
To put it into some perspective, we never actually check the platform, there's no decision based on that. Simply, this is a web plugin that has its implementation in
flutter_dropzone_plugin.dart
. You only get this error message if, for some reason, it doesn't register and start the plugin. As I still can't trigger the error, could you help me a bit with this? This is how it works (or is supposed to work):We have an abstract class and the static
instance
is initialized with it:But as soon as the real web plugin is registered, this
instance
gets overwritten:And from now on, any part the uses this instance will use the web plugin. You only get the error message if this registration doesn't work and the instance keeps the original value (where all functions lead to a very deliberate exception):
So, the question would be if you could debug this
registerWith()
function, maybe with some log readouts, to see how far you can get in your code.
I don't know what happened, I was away for a day. But it's working now ... I think the real web plugin failed to register for some reason. And for confirmation, do I need all 3 plugins/packages in my dependencies ?? There is a generated file : generated_plugin_registrant.dart
in your example folder , which I don't have.
I am using this library in my web app not desktop app but I am still facing this issue . its working fine in debug mode but when we go to live server or you say release mode i am facing this issue