LDClickTargetResolver typedef
LDClickTargetResolver =
LDClickTargetInfo? Function(Widget widget)
Recognizes an application's own widget types as click targets.
Automatic capture already recognizes the Material and Cupertino widgets, but
a design system's PrimaryButton looks like an anonymous composition of them.
Return an LDClickTargetInfo for the types you want named, and null for
everything else so the built-in rules apply.
LDClickTargetInfo? myResolver(Widget widget) => switch (widget) {
PrimaryButton(:final label) =>
LDClickTargetInfo(tag: 'PrimaryButton', text: label),
_ => null,
};
Runs for every widget above the tap on the way down, so keep it cheap and free of side effects. An exception is caught and logged, and resolution continues with the built-in rules.
Implementation
typedef LDClickTargetResolver = LDClickTargetInfo? Function(Widget widget);