dynatrace_flutter_plugin_dio 3.253.1 dynatrace_flutter_plugin_dio: ^3.253.1 copied to clipboard
An extension of the Dynatrace Flutter Plugin which allows support for instrumentation of the Dio package.
Dynatrace Flutter Plugin support with Dio #
This plugin adds support/instrumentation for dio when used with the Dynatrace Flutter Plugin.
Requirements #
- Dynatrace Flutter Plugin.
- Flutter Version >= 1.12.0
- Dart Version >= 2.12
- Gradle: >= 5.x
- Android API Level >= 21
- iOS SDK >= 9
Usage #
Our plugin for Dio provides an extension method, .instrument()
, which can be used to automatically tag and time the web requests that are called with the Dio package.
import 'package:dynatrace_flutter_plugin_dio/dynatrace_flutter_plugin_dio.dart';
final dio = Dio();
dio.instrument();
Create a user action and correlate the dio
request shown in the Waterfall analysis:
import 'package:dynatrace_flutter_plugin_dio/dynatrace_flutter_plugin_dio.dart';
import 'package:dynatrace_flutter_plugin/dynatrace_flutter_plugin.dart';
final dio = Dio();
dio.instrument();
var url = 'https://dynatrace.com';
DynatraceRootAction dioAction =
Dynatrace().enterAction('Dio Action');
try {
await dio.get(url);
} catch (error) {
// insert error handling here
} finally {
dioAction.leaveAction();
}
Note:
If you do not create a user action around the dio
request, our plugin will automatically create a user action which will include the request in the Waterfall analysis of such action. The name of this action is **Dio Request: