简体   繁体   English

Dartium及其使用dart:io

[英]Dartium and it's use of dart:io

I am building a feature-rich standalone application using dart. 我正在使用dart构建功能丰富的独立应用程序。 I picked dart since it seemed to allow not only the standard development approach for webapps but also to access system resources (such as nodejs does). 我选择dart是因为它似乎不仅允许标准的webapp开发方法而且允许访问系统资源(例如nodejs)。 One of my requirements is file io or database access (which again requires file io). 我的要求之一是文件io或数据库访问(再次需要文件io)。 Dartium however does not allow the use of the dart:io package (only in servermode is this library accessible). 但是,Dartium不允许使用dart:io包(仅在服务器模式下可访问此库)。 Can anybody think of a workaround, a change to the dart environment or the chromium environment to allow this ? 任何人都可以考虑解决方法,更改飞镖环境或铬环境以允许这样做吗? Maybe a custom compiled dartVM in the browser environemnt. 也许是在浏览器环境中的自定义已编译dartVM。

Basically a way to use database connections in a dart standalone app. 基本上是在dart独立应用程序中使用数据库连接的方法。 A REST wrapper is only an option if this code could get generated automatically. 如果可以自动生成此代码,则仅使用REST包装器。

I am not clear if such a thing is possible or if chromium will prevent any approach to access system resources. 我不清楚这种事情是否可能发生,或者铬是否会阻止任何访问系统资源的方法。

Yes in standalone mode dart you can use files, and also TCP socket, and web socket. 是的,在独立模式下,您可以使用文件,TCP套接字和Web套接字。 So you can connect to databases. 这样就可以连接数据库了。 (for example to MySQL: https://github.com/jamesots/sqljocky ) (例如,对于MySQL: https : //github.com/jamesots/sqljocky

In browser mode you can use built-in databases dart:indexed_db or dart:web_sql. 在浏览器模式下,您可以使用内置数据库dart:indexed_db或dart:web_sql。 You can also use web-socket protocol 您还可以使用网络套接字协议

Maybe you can use websocket to connect with local or remote database. 也许您可以使用websocket连接本地或远程数据库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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