showSurveyPage method

  1. @override
Future<bool> showSurveyPage(
  1. BuildContext context, {
  2. required String appId,
  3. required String linkOrToken,
  4. Map<String, String>? options,
  5. VoidCallback? onCompleted,
  6. VoidCallback? onError,
  7. VoidCallback? onDismissed,
})
override

Implementation

@override
Future<bool> showSurveyPage(
  BuildContext context, {
  required String appId,
  required String linkOrToken,
  Map<String, String>? options,
  VoidCallback? onCompleted,
  VoidCallback? onError,
  VoidCallback? onDismissed,
}) async {
  String url = "$_baseUrl$linkOrToken/${getParams(options)}";

  final dispatcher = CustomerPulseEventDispatcher(
    onCompleted: onCompleted,
    onError: onError,
    onDismissed: onDismissed,
  );

  await Navigator.of(context).push(
    MaterialPageRoute(
      builder: (context) =>
          CustomerPulsePage(url: url, dispatcher: dispatcher),
    ),
  );
  // The route has popped. If the survey was not completed and the in-web-view
  // close event did not already fire the dismiss, treat the route pop (back
  // button, AppBar, programmatic pop) as a user-driven dismiss.
  dispatcher.fireDismissedIfNeeded();
  return true;
}