# Dynatrace Instrument mobile apps with Flutter

**URL:** <https://community.dynatrace.com/t/dynatrace-instrument-mobile-apps-with-flutter/45605>\
**Category:** Real User Monitoring\
**Tags:** real-user-monitoring-classic, mobile-monitoring, user-sessions\
**Created:** [May 15, 2024, 5:32pm UTC](https://community.dynatrace.com/t/dynatrace-instrument-mobile-apps-with-flutter/45605 "2024-05-15T17:32:10Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![KM-DT](https://avatars.discourse-cdn.com/v4/letter/k/a183cd/32.png) [@KM-DT](https://community.dynatrace.com/u/KM-DT)\
**Post date:** [May 15, 2024, 5:32pm UTC](https://community.dynatrace.com/t/dynatrace-instrument-mobile-apps-with-flutter/45605/1 "2024-05-15T17:32:10Z")

</div>

Hi All

Is it possible to use Dynatrace to monitor these 3 parts of flutter?

1.web socket/socket.io

2.flutter for webview

3.http for&nbsp;lib dio

---

<div class="post-metadata">

**Author:** ![PierreGutierrez](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/pierregutierrez/32/5934_2.png) [@PierreGutierrez](https://community.dynatrace.com/u/PierreGutierrez)\
**Post date:** [May 15, 2024, 11:39pm UTC](https://community.dynatrace.com/t/dynatrace-instrument-mobile-apps-with-flutter/45605/2 "2024-05-15T23:39:48Z")

</div>

Hi&nbsp;[@KM-DT](https://community.dynatrace.com/user/75803)

From a “Real user monitoring (RUM)” perspective, YES, Dynatrace can monitor all of this.

**1.web socket/socket.io and 3.http for lib gave**

Both are communication technologies/protocols between applications and servers.  
You could help yourself with automatic instrumentation or perhaps manual instrumentation (so that you have greater control of your request)  
Example :

 ![PierreGutierrez_0-1715815973922.png](https://global.discourse-cdn.com/dynatrace/original/2X/a/a42436d75286d39937537306ffc89742ac32e037.png)

**2.flutter for webview**  
The web view part is monitored by the web application via the JS agent.  
--------------------------------------------------------------------------------------------------------------------------  
I share the Flutter instrumentation steps, in case you need them

 ![PierreGutierrez_2-1715816169863.png](https://global.discourse-cdn.com/dynatrace/original/2X/5/5c903f3fae893b856cc2d357db586aa51301a9f5.png)  
&nbsp;&nbsp;  
 ![PierreGutierrez_3-1715816281482.png](https://global.discourse-cdn.com/dynatrace/original/2X/6/6d26349fefeccb59839713153d4513f8dd71f25d.png)

For more information you can search here :&nbsp; [https://docs.dynatrace.com/docs/shortlink/flutter](https://docs.dynatrace.com/docs/shortlink/flutter)&nbsp;  
Demo implementation of Flutter :&nbsp;[dynatrace\_flutter\_plugin example | Flutter package (pub.dev)](https://pub.dev/packages/dynatrace_flutter_plugin/example)

I hope it’s helpful 💪

---

<div class="post-metadata">

**Author:** ![KM-DT](https://avatars.discourse-cdn.com/v4/letter/k/a183cd/32.png) [@KM-DT](https://community.dynatrace.com/u/KM-DT)\
**Post date:** [May 16, 2024, 5:31am UTC](https://community.dynatrace.com/t/dynatrace-instrument-mobile-apps-with-flutter/45605/3 "2024-05-16T05:31:09Z")

</div>

Hello&nbsp;PierreGutierrez

Initially, I have already auto-instrumented in flutter, but we can see only the http request action.

1.How to&nbsp;automatic instrumentation for [socket.io](http://socket.io) ?

2.I see additional documentation for the lib dio. If I want to do automatic instrumentation, can I import the package:dynatrace\_flutter\_plugin\_dio/dynatrace\_flutter\_plugin\_dio.dart’ in this document?

> **[dynatrace\_flutter\_plugin\_dio | Flutter package](https://pub.dev/packages/dynatrace_flutter_plugin_dio)**
>
> An extension of the Dynatrace Flutter Plugin which allows support for instrumentation of the Dio package.

3.The web view part is monitored from your steps, I have already done it and still don’t see the web view action.

web application via the JS agent, do you mean need agentless monitoring and inject the JavaScript tag

---

<div class="post-metadata">

**Author:** ![matthias\_hochri](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/matthias_hochri/32/15052_2.png) [@matthias\_hochri](https://community.dynatrace.com/u/matthias_hochri)\
**Post date:** [May 16, 2024, 10:33am UTC](https://community.dynatrace.com/t/dynatrace-instrument-mobile-apps-with-flutter/45605/4 "2024-05-16T10:33:41Z")

</div>

1.) There is no automatic instrumentation. + Manual instrumentation is for HTTP protocol. Not sure if Websockets somehow can be monitored with this.

2) Correct. Use this package.

3) You need to inject into the web application the JavaScript Tag. Is the content localhost or some external page?

---

<div class="post-metadata">

**Author:** ![KM-DT](https://avatars.discourse-cdn.com/v4/letter/k/a183cd/32.png) [@KM-DT](https://community.dynatrace.com/u/KM-DT)\
**Post date:** [May 16, 2024, 11:17am UTC](https://community.dynatrace.com/t/dynatrace-instrument-mobile-apps-with-flutter/45605/5 "2024-05-16T11:17:39Z")

</div>

Hello&nbsp;matthias\_hochri

1.)Can you check and confirm about websocket whether it supports or not?

if support what kind of instrumentation is required?

2.Thank you for your confirmation.

3.flutter webview use same method with agentless, So can inject into the JavaScript tag too right?

---

<div class="post-metadata">

**Author:** ![matthias\_hochri](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/matthias_hochri/32/15052_2.png) [@matthias\_hochri](https://community.dynatrace.com/u/matthias_hochri)\
**Post date:** [May 17, 2024, 7:48am UTC](https://community.dynatrace.com/t/dynatrace-instrument-mobile-apps-with-flutter/45605/6 "2024-05-17T07:48:35Z")

</div>

3) Yeah simply inject/add the JavaScript agent tag and enable hybridWebView mode on native agents. This should merge sessions of Mobile and what happens in the Webview. For further assistance please create a support ticket as this is too complex here.

1) Our native agent supports and allows tracking of ws/wss as well. Tracking of Websockets can be done by marking start and end. Thus this makes sense for Websockets with shorter duration. If you keep your Socket connection open for a long time, this monitoring is not supported currently.

There is a documentation for Android available here:&nbsp;[Instrumentation via OneAgent SDK for Android in RUM Classic — Dynatrace Docs](https://docs.dynatrace.com/docs/platform-modules/digital-experience/mobile-applications/instrument-android-app/instrumentation-via-oneagent-sdk/oneagent-sdk-for-android#monitor-non-http-requests)&nbsp;- Basically this work similar in Flutter because the WebRequestTiming API is available there as well.

---

<div class="post-metadata">

**Author:** ![KM-DT](https://avatars.discourse-cdn.com/v4/letter/k/a183cd/32.png) [@KM-DT](https://community.dynatrace.com/u/KM-DT)\
**Post date:** [May 17, 2024, 11:13am UTC](https://community.dynatrace.com/t/dynatrace-instrument-mobile-apps-with-flutter/45605/7 "2024-05-17T11:13:39Z")

</div>

Hello&nbsp;matthias\_hochri

1.Does it need to have oneagent on the server side or not?

Or just the oneagent on mobile native?

3.Thank you for your information.

---

<div class="post-metadata">

**Author:** ![PierreGutierrez](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/pierregutierrez/32/5934_2.png) [@PierreGutierrez](https://community.dynatrace.com/u/PierreGutierrez)\
**Post date:** [May 18, 2024, 3:20am UTC](https://community.dynatrace.com/t/dynatrace-instrument-mobile-apps-with-flutter/45605/8 "2024-05-18T03:20:52Z")

</div>

Hi&nbsp;[@KM-DT](https://community.dynatrace.com/user/75803)&nbsp;  
I am agree with the answers by Matthias, I will add some details that may be useful to you.  
&nbsp;  
3 .-&nbsp;Yes, you can monitoring with OneAgent’s JavaScript injection the webview.  
Is not mandatory to enable "hybridWebView&nbsp;", but it is a good recommendation however it requires some additional configuration.  
The reason I say this is because there are some cases where the customer initially wants to monitor it separately (so as not to combine the apdex), and later unify it with “hybridWebView”.

1.- In that case ( WebSocket ), manual instrumentation is necessary. And for this it is necessary to have the Dynatrace for Flutter library import.

```javascript
import 'package:dynatrace_flutter_plugin/dynatrace_flutter_plugin.dart';

```

You may have to take into consideration some rules mentioned in ws/wss call recognition (&nbsp;[Instrumentation via OneAgent SDK for Android in RUM Classic — Dynatrace Docs](https://docs.dynatrace.com/docs/shortlink/oneagent-sdk-for-android#monitor-non-http-requests)&nbsp;)

 ![PierreGutierrez_0-1716002215813.png](https://global.discourse-cdn.com/dynatrace/original/2X/c/c149b2dc15a14ef2c5e58812952c60da8d99f075.png)

I hope it’s helpfull 💪

---

<div class="post-metadata">

**Author:** ![KM-DT](https://avatars.discourse-cdn.com/v4/letter/k/a183cd/32.png) [@KM-DT](https://community.dynatrace.com/u/KM-DT)\
**Post date:** [May 18, 2024, 7:06am UTC](https://community.dynatrace.com/t/dynatrace-instrument-mobile-apps-with-flutter/45605/9 "2024-05-18T07:06:33Z")

</div>

Hello

Thank for more detail.

I have more question,If it’s non-HTTP(s), such as gRPC, will it be able to see Networks Request?

---

<div class="post-metadata">

**Author:** ![matthias\_hochri](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/matthias_hochri/32/15052_2.png) [@matthias\_hochri](https://community.dynatrace.com/u/matthias_hochri)\
**Post date:** [May 21, 2024, 10:20am UTC](https://community.dynatrace.com/t/dynatrace-instrument-mobile-apps-with-flutter/45605/10 "2024-05-21T10:20:08Z")

</div>

Currently we only support http(s) and ws(s). So if the endpoint starts differently the tracking might not work as the URL validation fails on the agent side.
