pauseRandomTaskBuilderAndPushWidget method
Pause and resume a RandomTasks while pushing a widget builder
.
This method is useful when implementing a pause menu for example.
Implementation
Future<void> pauseRandomTaskBuilderAndPushWidget(
final WidgetBuilder builder,
) async {
RandomTasks.maybeOf(this)?.pause();
await Navigator.of(this).push(MaterialPageRoute<void>(builder: builder));
RandomTasks.maybeOf(this)?.resume();
}