We built a wrapper so you can use our mobile SDKs in your Flutter app.

First, let's make sure you have all the necessary tools installed in your local environment so you can run Flutter.

If you already have a Flutter app skip to Step 3.

1. Install Flutter for your operating system

You can install Flutter for your operating system following the Getting Started guide from Flutter here https://docs.flutter.dev/get-started/install.

2. Create and run a simple Flutter app

Create a new app by running the following command. In our example, we'll name our app "imdemo".

$ flutter create imdemo

Let's move to our app's directory and run the app

$ cd imdemo
$ flutter run

You should see the application running on your browser or the device you choose. Here's how it looks running on the iOS Simulator.

3. Import "wootricsdk_flutter"

Add the Wootric wrapper using the command flutter pub add.

flutter pub add wootricsdk_flutter

Open the "main.dart" file inside the /lib folder and import the wootricsdk_flutter package.

import 'package:wootricsdk_flutter/wootricsdk_flutter.dart';

4. Configure WootricsdkFlutter and show the survey

You can configure and show the survey wherever you like. Let's do it in the initState() function of _MyHomePageState.

@override
void initState() {
WootricsdkFlutter.configure(
clientId: "YOUR_WOOTRIC_CLIENT_ID",
accountToken: "YOUR_ACCOUNT_TOKEN",
);
WootricsdkFlutter.setEndUserEmail('test@email.com');
WootricsdkFlutter.setEndUserPropteries({
'country': 'Germany',
'age_amount': "36",
});
WootricsdkFlutter.forceSurvey(true);
WootricsdkFlutter.showSurvey();
}

Replace YOUR_WOOTRIC_CLIENT_ID and YOUR_ACCOUNT_TOKEN with the respective values for your account.

  • YOUR_WOOTRIC_CLIENT_ID you can find it in your Settings >> Integrations >> API.

  • YOUR_ACCOUNT_TOKEN is located in Settings >> Your Account.

5. Run again using flutter run. The survey should appear in your app! 🎉

Did this answer your question?