toggle method

Future<void> toggle({
  1. bool animated = true,
})

Convenience method for showing/hiding the tooltip.

This method should typically not be called while the widget tree is being rebuilt.

Testing

To avoid timeouts in widget tests, always wrap the returned Future in unawaited.

testWidgets('shows', (tester) async {
  await tester.pumpWidget(...);

  unawaited(controller.show());
  await tester.pumpAndSettle();
});

Implementation

Future<void> toggle({bool animated = true}) =>
    _animation.status.isForwardOrCompleted ? hide(animated: animated) : show(animated: animated);