admin管理员组文章数量:1355713
I am writing two applications. The first is a server dart application, which works via the Windows command line. The second is a flutter client application, with a user interface. The applications exchange data via a web server deployed in the first application.
In the first application, logs are output to the Windows command line via < print >. How can I get these logs in real time in the second application?
There is an idea to get logs via riverpod or by writing/reading logs from an external file, but I think this is not optimal.
I am writing two applications. The first is a server dart application, which works via the Windows command line. The second is a flutter client application, with a user interface. The applications exchange data via a web server deployed in the first application.
In the first application, logs are output to the Windows command line via < print >. How can I get these logs in real time in the second application?
There is an idea to get logs via riverpod or by writing/reading logs from an external file, but I think this is not optimal.
Share Improve this question asked Mar 28 at 6:25 Артем ИльинскийАртем Ильинский 2991 silver badge10 bronze badges3 Answers
Reset to default 1I suggest you create an API, such as using Node.JS.
This API will serve as a middleman data access layer between your apps, regardless of platform or type of apps.
You have to use a single API service across your apps, then add some logic for how you transfer and retrieve log data while interacting with your apps.
Riverpod would also be useful in handling state changes management.
Also, I recommend dio which will serve as:
A powerful HTTP networking package for Dart/Flutter, supports Global configuration, Interceptors, FormData, Request cancellation, File uploading/downloading, Timeout, Custom adapters, Transformers, etc.
It is pretty useful if you integrate them into your system architecture.
I hope this helps!
https://developer.android/tools/logcat
You can use logcat to get logs of devices from all apps
Use a websocket server, to send the logs to the client. Then use the StreamBuilderWidget, and use the websocket like that.
final channel = IOWebSocketChannel.connect('ws://localhost:8080');
StreamBuilder(
stream: channel.stream,
builder: (context, snapshot) {
if (snapshot.hasData) {
return Text(snapshot.data.toString());
}
return Center(child: CircularProgressIndicator());
},
),
本文标签: flutterHow to show logs from another applicationStack Overflow
版权声明:本文标题:flutter - How to show logs from another application? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744053033a2582770.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论