Skip to content

Flutter

The Flutter wrapper is a thin bridge over the native iOS and Android SDKs. Surveys render as fully native UI, no survey UI lives in Dart. It exposes exactly what the native SDKs expose and, like them, is fire-and-forget: the returned futures complete when the call has been dispatched to the platform, never with a survey outcome, and failures are logged natively rather than surfaced to Dart.

Terminal window
flutter pub add flutter_whiskrkit

The native WhiskrKit SDK is a Swift package, and the plugin declares it as a Swift Package Manager dependency. Flutter resolves it automatically when Swift Package Manager support is enabled (the default in current Flutter; otherwise run flutter config --enable-swift-package-manager).

Set your app’s iOS deployment target to 17.0 in ios/Runner.xcodeproj.

If your app has SwiftPM support disabled, supply the WhiskrKit Swift package via the cocoapods-spm plugin instead.

The eu.whiskrkit:whiskrkit-android dependency resolves from Maven Central with no extra setup. Just make sure your app’s minSdkVersion is 26 or higher (android/app/build.gradle).

Create an instance of FlutterWhiskrkit, then call its methods. initialize must be called before the others; calls made without it are silent no-ops (logged natively). Attachment to the host app happens automatically on initialize; there is no widget to mount.

import 'package:flutter_whiskrkit/flutter_whiskrkit.dart';
final whiskrkit = FlutterWhiskrkit();

Initialises the SDK and attaches WhiskrKit to your app. Call once, at startup, e.g. in your root widget’s initState.

await whiskrkit.initialize('wk_live_your_api_key');
// With mocked surveys for local development:
await whiskrkit.initialize('any-string', withMockedSurveys: true);
ParameterTypeDescription
apiKeyStringYour WhiskrKit API key from the dashboard
withMockedSurveysboolUse local mock data instead of the API. Defaults to false

Returns Future<void>.


Imperatively presents a survey, bypassing eligibility checks. Use for a feedback button, a push-notification handler, or any trigger you own.

await whiskrkit.present('nps-survey');
ParameterTypeDescription
surveyIdStringThe identifier of the survey to present

Returns Future<void>.


Checks eligibility and presents a survey if the user qualifies. The timing is yours; the targeting decision stays with the backend.

await whiskrkit.checkAndPresent('settings-feedback');
ParameterTypeDescription
surveyIdStringThe identifier of the survey to evaluate and potentially present

Returns Future<void>.

The native SDKs offer a declarative “present on appear” attachment (SwiftUI’s .whiskrKitSurvey modifier, Jetpack Compose’s WhiskrKitSurvey). The Flutter wrapper does not ship a dedicated widget for this, because a widget that renders nothing purely to fire a side effect is awkward in Flutter. Instead, get the same behaviour by calling checkAndPresent when a screen initialises:

class FeedbackScreen extends StatefulWidget {
const FeedbackScreen({super.key});
@override
State<FeedbackScreen> createState() => _FeedbackScreenState();
}
class _FeedbackScreenState extends State<FeedbackScreen> {
@override
void initState() {
super.initState();
FlutterWhiskrkit().checkAndPresent('nps-survey');
}
@override
Widget build(BuildContext context) => const YourScreen();
}

This runs the eligibility check once when the screen appears and presents the survey only if the user qualifies, exactly like the native automatic mode.

Fire-and-forget, silent failure. The native SDKs never surface errors or survey lifecycle events, so neither does the wrapper: there are no completion events, no streams, and no error codes. The futures resolve on dispatch, not on outcome. When debugging, watch the native logs: Console.app (subsystem WhiskrKit) on iOS, Logcat (tag WhiskrKit) on Android.

No theming API. Theming is native-only and is not exposed through the wrapper. Surveys use the SDK defaults.

RequirementMinimum
iOS17.0
Android minSdk26