flutter - How to show logs from another application? - Stack Overflow

I am writing two applications. The first is a server dart application, which works via the Windows comm

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 badges
Add a comment  | 

3 Answers 3

Reset to default 1

I 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());
     },
),

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744053033a4550421.html

相关推荐

  • flutter - How to show logs from another application? - Stack Overflow

    I am writing two applications. The first is a server dart application, which works via the Windows comm

    9天前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信