-
-
Notifications
You must be signed in to change notification settings - Fork 206
full support for flutter-web #385
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
Comments
Hey I definitley think we should support flutter-web. I've been majorly tied up over the last few months so not had a chance to look into it. I was under the impression that Sembast would support flutter-web but I could be wrong. It would be great if we supported all platforms that Dart is able to run on? |
It seems like universal_io should solve this problem. |
Can we not just include universal_io? Seems it should do the trick. |
I think this is just due to Platform.isAndroid etc. not being supported. At least that's were it breaks for me first. I'll create a PR later, as we need this now, if we still want web to keep on working for us. |
So my bad #392 did not fix web, but circumvented the first issue that arose.
Seems to be that devicelocale.currentLocale does not work on web. Edit: Devicelocale does not support web: magnatronus/flutter-devicelocale#9 |
To get the current locale without the package devicelocale we can use: https://api.flutter.dev/flutter/dart-ui/Window/locale.html Would look like this in parse_installation.dart: //Locale
if (!kIsWeb) {
final String locale = await Devicelocale.currentLocale;
if (locale != null && locale.isNotEmpty) {
set<String>(keyLocaleIdentifier, locale);
}
} else {
final String locale = ui.window.locale.languageCode;
if (locale != null && locale.isNotEmpty) {
set<String>(keyLocaleIdentifier, locale);
}
} Next unsupported package is package_info: flutter/flutter#46609 This could also be just skipped by checking for kIsWeb:
But now when creating a new user, I get this error:
Not sure where to go from here, maybe @phillwiggins has an idea what is going wrong? |
I think I traced the last one to the incompatibility of the http package. http added support for web with this note:
IOClient uses the dart:io package, which is not available on web. Will see if there is an alternative. This line in ParseHttpClient uses IOClient if a security context is given: _client = securityContext != null
? IOClient(HttpClient(context: securityContext))
: Client(); I'll try to find a way of not using IOClient, but not sure if possible. EDIT: It seems to use BrowserClient instead of IOClient and still fail. So probably still a different issue. |
Alright scratch the http package. In the end is a CORS error. I think that should be fixable.
|
There is an option provided by the server to add custom headers. Using env variables: |
PARSE_SERVER_ALLOW_HEADERS is not working for my heroku setup sadly. Not sure what I am doing wrong: Is this normally required to set when using a the mobile SDKs? Looking at parse-server there are default headers, which do not include the installation-id:
I guess mobile does not care about CORS and preflight. But for supporting web, we should either:
EDIT: Was able to set allowHeaders in ParseServerOptions. The parsing of the heroku env vars does not work for some reason. |
I think the best solution is to add a note to the REAMDE for bow. And once web is tested a bit more and seems to work with the additional header we should create a pr to parse-server. I am using the env methode in a kubernetes enviroment. Maybe it is only supported when using the docker image. |
I agree with first adding something to Readme and then looking further. Could be that the env variables are not passed through to the ParseServer npm package. PR incoming |
@nstrelow |
Exception when run for web: Unsupported operation: Platform._operatingSystem |
No activity on this in a white. Can this be closed? |
I had no time recently to work on this, but I want to get back to this. |
I am currently experimenting with web support for ParseFile. Any other ideas/suggestions? |
I have started implementing this idea in this branch currently it seems to work just fine, but I have only tested reading, yet. |
I have created a pr that should enable full file support (#409). |
Last week I tried to run my app in the browser, it worked. but today It cannot log in to my app got the error below: Class: _User Function: ParseApiRQ.login Status Code: -1 Type: UnknownError Exception: XMLHttpRequest error. |
Sadly I have not encountered this issue and it could mean anything. Good luck on trying to fix it 💪 |
I'm lucky. It works today with nothing to fix. |
Maybe it was something with the server or the connection to the server was not fully working. |
Thank you. I got an error about "CoreStoreSharedPrefsImp" when I use Dart package instead of Flutter package. Do you have any suggestion? |
Why are you using the dart package instead of the flutter one? |
Just try #454 because I don't know how to fix the XMLHttpRequest error. |
Is there any hint in your browsers log?
|
I got this error in the console. |
So "X-Parse-Installation-Id" Check lower-case / upper-case writing. |
Thank you. I already add this JSON to Parse Server Options: |
It works now when I changed the domain 'https://parseapi.back4app.com' to 'https://vcm.back4app.io' and deploy to Back4App. But still got an XMLHTTPRequest error when I ran from AndroidStudio. |
Do you have a ParseLiveListWidget in your widget tree before Parse.init() finished? |
@fischerscode @phillwiggins We have been using version 1.0.28 on Flutter Web for 3 weeks now and everything works smoothly 👍 |
@BaranMichal25
Glad to hear that, I am currently running this branch which uses dio, and I had no time testing both branches. @phillwiggins |
I'm fine for DIO to be used. Are there many breaking changes?
…On Fri, 2 Oct 2020 at 11:04, Maximilian Fischer ***@***.***> wrote:
@BaranMichal25 <https://github.com/BaranMichal25>
I would love, to add #458
<#458> to
1.0.28, maybe I will find time today to finish the tasks.
Only @phillwiggins <https://github.com/phillwiggins> can create a release
on pub.dev, as it is his personal account.
1.0.28-dev sounds like a good idea, too.
We have been using version 1.0.28 on Flutter Web for 3 weeks now and
everything works smoothly
Glad to hear that, I am currently running this branch
<https://github.com/fischerscode/Parse-SDK-Flutter/tree/testing-branch-1>
which uses dio, and I had no time testing both branches.
@phillwiggins <https://github.com/phillwiggins>
Should we use dio in 1.0.28?
For me it runs great and it would add support for the upload progress (
#366 <#366>).
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#385 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB4CPXQJDFMGYTZMOIOVBFDSIWQTPANCNFSM4NMNDNEA>
.
--
Kind Regards
Phill Wiggins
[email protected]
|
@phillwiggins |
Go for it then! I can release when you're ready.
I'm not actually using Flutter at the moment. That project has been
sidelined so I'm fine for breaking changes.
…On Fri, 2 Oct 2020 at 11:09, Maximilian Fischer ***@***.***> wrote:
@phillwiggins <https://github.com/phillwiggins>
Great!
I think there are not breaking changes at all. (Expect I you are
overriding the ParseHTTPClient?)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#385 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB4CPXW4MC2UQPRR6S3PENDSIWREFANCNFSM4NMNDNEA>
.
--
Kind Regards
Phill Wiggins
[email protected]
|
This is my init code: @OverRide Future initCoreStore() async { Future initData() async {
} |
I use 1.0.27 |
I think 1.0.27 does not fully support web, but most functions should work. |
Thank you. |
@fischerscode Anything holding off the release? |
Added section for tests at migration guide. Fix: parse-community#385 (comment)
Added section for tests at migration guide. Fix: #385 (comment)
With the release of 1.0.28, web should now be fully supported. |
@fischerscode Awesome, thanks for the hard work. |
I recently tried run my app in the browser.
Last time I tried this, it worked. This time it didn't.
The difference between success and failure is the login I added recently.
Unsupported operation: Platform._operatingSystem
is printed in the log.It seems like
dart:io
is causing the issue. firebase/flutterfire#1257For live query we have two separated files. One for mobile/desktop and one for web.
We could do similar for all the files using
dart:io
.Any ideas/suggestions? Or should we not support flutter-web?
Edit:
CoreStoreSembastImp would need an update, too. I think sembast has an extra package for web.
The text was updated successfully, but these errors were encountered: