Flutter SDK - tracking inputs
Text fields are not observed automatically — Flutter has no equivalent of UIKit’s responder chain to hook into. Attach the tracker to the controllers you care about, and it will listen to value changes (debounced) and send the resulting value to the OpenReplay backend.
Adding tracked inputs
Section titled Adding tracked inputsUse observeInput(controller, label:, masked:):
controller: TextEditingController— the controller to observelabel: String— label for the recorded inputmasked: bool— iftrue, the tracker records the input event but sends****instead of the value. Default:false.
It returns a callback that removes the listener, so wire it into dispose():
import 'package:openreplay/openreplay.dart';
class _LoginFormState extends State<LoginForm> {
final _email = TextEditingController();
late final VoidCallback _stopObserving;
@override
void initState() {
super.initState();
_stopObserving = OpenReplay.instance.observeInput(_email, label: 'Email');
}
@override
void dispose() {
_stopObserving();
_email.dispose();
super.dispose();
}
}
Have questions?
Section titled Have questions?If you have any questions about this process, feel free to reach out to us on our Slack or check out our Forum.