postgresql-dart icon indicating copy to clipboard operation
postgresql-dart copied to clipboard

Update to flutter web

Open massimoliani opened this issue 6 years ago • 6 comments

I would like to know if you are planning to upgrade the code to flutter web edition. I try to use the module but the compiler stop with version not supported.

Thanks

massimoliani avatar May 12 '19 17:05 massimoliani

@massimoliani what's the error message you are getting?

isoos avatar May 12 '19 21:05 isoos

hi @isoos, I'm completely new to dart and flutter development, I'm looking for a framework for web development more friendly to the development I'm used to C++. I install vscode with flutter web extension, than install dart too (flutter web as I understood is still in preview). I generate a new hello world project and make a class to encapsulate your postgres library. My plan is to design a web app connecting to a postgres server. Right now to make the first test I subscribe a heroku free account with free postgres database and today I was playing with flutter to understand if can be suitable to my final application, for this reason I look for postgres lib.

The error from web compiler is: build_web_compilers:entrypoint on web/main.dart: Skipping compiling hello_world|web/main.dart with ddc because some of its transitive libraries have sdk dependencies that not supported on this platform:

postgres|lib/src/query.dart postgres|lib/src/message_window.dart postgres|lib/src/connection.dart

https://github.com/dart-lang/build/blob/master/docs/faq.md#how-can-i-resolve-skipped-compiling-warnings

I attach the hello world project if you need. hello_world.zip

massimoliani avatar May 12 '19 21:05 massimoliani

@massimoliani: First of all, the error message is about a platform conflict: you can't use (directly or transitively) the dart:io library from a web app (a JS app).

You will need to have two parts in your project: one part is a web app (compiles to js, uses the web compiler: webdev serve or dart2js) while the other one is a server application that the web app connects to (uses the postgresql package).

I don't have a good tutorial for this out of my head, it is likely you'd need to look for these (or ask on gitter or stackoverflow)

isoos avatar May 12 '19 21:05 isoos

@isoos Understood, I have to organize in a client server topology having a dart server app managing database.

Thanks for your help.

massimoliani avatar May 12 '19 21:05 massimoliani

@isoos, hello! Does it work for Flutter Web? With Web, I even can't await for connection.open() for web. Don't know, why.

vprudnikoff avatar Jun 01 '20 17:06 vprudnikoff

@prudnikoff: I don't think that you can connect to a random TCP port from a browser. You should probably use a server app that the Flutter Web app is communicating with...

isoos avatar Jun 01 '20 19:06 isoos