DatadogRouteAwareMixin<T extends StatefulWidget> mixin
The DatadogRouteAwareMixin can be used to supply names and additional attributes to RUM views as an alternative to supplying a ViewInfoExtractor to DatadogNavigationObserver, supplying a name when creating the route, or using named routes.
Usage:
class ViewWidget extends StatefulWidget {
const ViewWidget({Key? key}) : super(key: key);
@override
_ViewWidgetState createState() => _ViewWidgetState();
}
class _ViewWidgetState extends State<ViewWidget>
with RouteAware, DatadogRouteAwareMixin {
// ...
}
By default, DatadogRouteAwareMixin will use the name of its parent Widget as the name of the route, but only when the code is not obfuscated.
If you are obfuscating your final code, or if you want to provide a different name or additional view attributes, you should override the rumViewInfo getter.
DatadogNavigationObserver uses the didChangeDependencies lifecycle method to start the RUM view. For this reason, you should avoid calling RUM methods during initState, and override didPush from RouteAware to do any initial setup instead.
Note: this should not be used with named routes. By design, the Mixin checks if a name was already assigned to its route and will not send any tracking events in that case
- Superclass Constraints
- State<
T> - RouteAware
- State<
Properties
- context → BuildContext
-
The location in the tree where this widget builds.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- mounted → bool
-
Whether this State object is currently in a tree.
no setterinherited
- rumViewInfo → RumViewInfo
-
Override this method to supply extra view info for this view through the
RumViewInfo class. By default, it returns the name of the parent Widget
as the name of the view.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- widget → T
-
The current configuration.
no setterinherited
Methods
-
activate(
) → void -
Called when this object is reinserted into the tree after having been
removed via deactivate.
inherited
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
inherited
-
deactivate(
) → void -
Called when this object is removed from the tree.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
didChangeDependencies(
) → void -
Called when a dependency of this State object changes.
override
-
didPop(
) → void -
Called when the current route has been popped off.
override
-
didPopNext(
) → void -
Called when the top route has been popped off, and the current route
shows up.
override
-
didPush(
) → void -
Called when the current route has been pushed.
override
-
didPushNext(
) → void -
Called when a new route has been pushed, and the current route is no
longer visible.
override
-
didUpdateWidget(
covariant T oldWidget) → void -
Called whenever the widget configuration changes.
inherited
-
dispose(
) → void -
Called when this object is removed from the tree permanently.
override
-
initState(
) → void -
Called when this object is inserted into the tree.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reassemble(
) → void -
Called whenever the application is reassembled during debugging, for
example during hot reload.
inherited
-
setState(
VoidCallback fn) → void -
Notify the framework that the internal state of this object has changed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringShort(
) → String -
A brief description of this object, usually just the runtimeType and the
hashCode.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited