简体   繁体   中英

Is it possiable to create a mySQL database for android app within flutter application and use that connection as a database server for flutter itself?

I am working on a flutter application and after deep research I realized that there is only an SQLite plugin that is well documented and other database options are almost non existent. They don't have simple and safe ways to integrate none-lite SQL like postgre or mySQL. My question is, has anyone know or done a connection with android and mySQL/postgre in the android section of the application in Flutter with a dedicated server and extend the server to be used in flutter through http so the dart files can access and decode the servers json data?

SQLite runs on the mobile device itself. It is lightweight and designed for that use case. MySQL and other such databases are desgined to run on a server, not a mobile device and you use it from a mobile device over network requests.

An SQL server is not supposed to be exposed directly to the internet because SQL is way too powerful and it's easy to take over the whole server with SQL commands.

To avoid that you hide an SQL server behind a Web server that provides a limited REST (or similar) API that is available to mobile devices (or web clients) and that API translates client requests to SQL commands.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM