WidgetTracker class
A class used for manually tracking activities throughout the app.
The available methods permit specifying the start and end of a Flutter widget to be reflected as an app screen in the controller.
Warning: Be sure to be using unique widget names. Duplicate names might result in unexpected behavior.
For apps using named routes, see NavigationObserver.
import 'package:appdynamics_agent/appdynamics_agent.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class CheckoutPage extends StatefulWidget {
const CheckoutPage({Key? key}) : super(key: key);
static String screenName = "Checkout Page";
@override
_CheckoutPageState createState() => _CheckoutPageState();
}
class _CheckoutPageState extends State<CheckoutPage> {
@override
void initState() async {
super.initState();
await WidgetTracker.instance.trackWidgetStart(CheckoutPage.screenName);
}
_backToMainScreen() async {
await WidgetTracker.instance.trackWidgetEnd(CheckoutPage.screenName);
Navigator.pop(context);
}
@override
Widget build(BuildContext context) {
return Center(
child:
Column(crossAxisAlignment: CrossAxisAlignment.stretch, children: [
ElevatedButton(
child: const Text('Proceed'),
onPressed: _backToMainScreen,
)
]));
}
}
Properties
- hashCode → int
-
The hash code for this object.
read-onlyinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
-
trackedWidgets
→ Map<
String, TrackedWidget> -
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
trackWidgetEnd(
String widgetName) → Future< void> - Tracks when a widget has ended.
-
trackWidgetStart(
String widgetName) → Future< void> - Tracks when a widget has started.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance → WidgetTracker
-
read-only