trackState function

CapybaraStateStore? trackState({
  1. required String library,
  2. required String label,
  3. required String via,
  4. required bool actions,
  5. required Object? read(),
  6. String? note,
})

Registers a store whose state Capybara records, before or after Capybara.run. Null where Capybara does nothing: release builds and the web.

library groups stores in the State tab (riverpod, bloc); via says how they were found (observer); actions says whether changes come with the name of what made them. read gives the current state.

Implementation

CapybaraStateStore? trackState({
  required String library,
  required String label,
  required String via,
  required bool actions,
  required Object? Function() read,
  String? note,
}) {
  if (!_enabled || kIsWeb) return null;
  return StateRegistry.instance.track(
    library: library,
    label: label,
    via: via,
    actions: actions,
    read: read,
    note: note,
  );
}