Instrumentation class

Main class used to interact with the AppDynamics agent.

This class provides several methods to instrument your app, including:

  • Initializing the agent with the right configuration and key;
  • Reporting timers, errors, session frames, custom metrics;
  • Shutting down and restarting agent;
  • Changing app key dynamically;
  • Tracking calls, and starting new sessions.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

blockScreenshots() Future<void>
Blocks screenshot capture if it is currently unblocked; otherwise this has no effect. Returns a Future which resolves when screenshots are effectively blocked.
changeAppKey(String newKey) Future<void>
Changes the app key after initialization.
crash() Future<void>
Crashes app from the native layer. Useful for testing crash reporting.
errorHandler(FlutterErrorDetails details) Future<void>
leaveBreadcrumb(String breadcrumb, BreadcrumbVisibility mode) Future<void>
Leaves a breadcrumb that will appear in a crash report and optionally, on the session.
nativeErrorHandler(FlutterErrorDetails details) Future<void>
Intercepts Flutter-level errors and reports them to the controller.
removeUserData(String key) Future<void>
Removes the String corresponding to a key set with setUserData.
removeUserDataBool(String key) Future<void>
Removes the bool corresponding to a key set with setUserDataBool.
removeUserDataDateTime(String key) Future<void>
Removes the DateTime corresponding to a key set with setUserDataDateTime.
removeUserDataDouble(String key) Future<void>
Removes the double corresponding to a key set with setUserDataDouble.
removeUserDataInt(String key) Future<void>
Removes the int corresponding to a key set with setUserDataInt.
reportError(Error error, {ErrorSeverityLevel severityLevel = ErrorSeverityLevel.warning}) Future<void>
Reports an Error that was caught. Includes the error's stack trace.
reportException(Exception exception, {ErrorSeverityLevel severityLevel = ErrorSeverityLevel.warning, StackTrace? stackTrace}) Future<void>
Reports an Exception that was caught.
reportMessage(String message, {ErrorSeverityLevel severityLevel = ErrorSeverityLevel.warning, StackTrace? stackTrace}) Future<void>
Reports a custom message with a corresponding severity and sometimes with a stack trace.
reportMetric({required String name, required int value}) Future<void>
Allows reporting numeric values associated with a metric name. For example, to track the number of times your users clicked the checkout button.
restartAgent() Future<void>
Restarts sending beacons to the collector.
screenshotsBlocked() Future<bool>
Returns a bool that specifies whether screenshot capturing is blocked.
setUserData(String key, String? value) Future<void>
Sets a key-value pair identifier that will be included in all snapshots. This identifier can be used to add the String types.
setUserDataBool(String key, bool? value) Future<void>
Sets a key-value pair identifier that will be included in all snapshots. This identifier can be used to add the bool types.
setUserDataDateTime(String key, DateTime? value) Future<void>
Sets a key-value pair identifier that will be included in all snapshots. This identifier can be used to add the DateTime types.
setUserDataDouble(String key, double? value) Future<void>
Sets a key-value pair identifier that will be included in all snapshots. This identifier can be used to add the double types.
setUserDataInt(String key, int? value) Future<void>
Sets a key-value pair identifier that will be included in all snapshots. This identifier can be used to add the int types.
shutdownAgent() Future<void>
Blocks sending beacons to the collector.
sleep(Duration duration) Future<void>
Calls thread sleep on the native layer. Useful for testing ANR reporting.
start(AgentConfiguration config) Future<void>
Initializes the agent.
startNextSession() Future<void>
Starts next session and ends the current session.
startSessionFrame(String sessionFrameName) Future<SessionFrame>
Starts and returns a SessionFrame object.
startTimer(String name) Future<void>
Times events by using custom timers that span across multiple methods.
stopTimer(String name) Future<void>
Stops timer started with Instrumentation.startTimer.
takeScreenshot() Future<void>
Asynchronously takes a screenshot of the current screen.
trackCall<T>({required String className, required String methodName, required FutureOr<T> methodBody(), dynamic methodArgs, String? uniqueCallId}) Future<T?>
Reports that a method call has started.
unblockScreenshots() Future<void>
Unblocks screenshot capture if it is currently blocked, otherwise this has no effect. Returns a Future which resolves when screenshots are effectively unblocked.

Constants

maxUserDataStringLength → const int