Flutter

Setting up Blitzllama for your Flutter app is easy and you can do it by following the steps. The complete SDK integration into a Flutter app takes an average of 10 mins.

The three main sections here are:

  • Integrating the SDK: retrieving and adding the SDK to your project

  • Managing Users: creating a new user and setting user attributes

  • Adding Triggers: add triggers in critical components inside your app to initiate the micro-surveys

1. Integrating the SDK

Open pubspec.yaml and add the following dependencies:

dependencies:
    blitzllama_flutter: ^0.6.1

Next, open the terminal window then run the command flutter pub get

import 'package:blitzllama_flutter/blitzllama_flutter.dart';
..
..
.
.

BlitzllamaFlutter.init("<api_key>");

Please add the above line to the file to which Blitzllama functions are added.

Check pub.dev for usages and examples.

In case you face issues with iOS builds, Please add below snippet to run frameworks

target 'Runner' do
  use_frameworks!
  pod 'SwiftyJSON'
  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

2. Managing Users

Create User

It is mandatory to create users using unique user IDs. Not only does it provide a consistent experience across platforms, but it also prevents users from being surveyed multiple times.

Create a user with a unique user_id to prevent any inconsistencies.

Please clear storage, if you are switching between projects in the same device.

BlitzllamaFlutter.createUser(user_id);

Update User Email (optional)

You can provide Blitzllama with the user's email address. Email address is not mandatory for Flutter micro-surveys.

BlitzllamaFlutter.setUserEmail(email)

Update User Name (optional)

You can also provide Blitzllama with the user's name. It can be used to make the questions more personalized. The user name is, again, not mandatory to launch surveys.

BlitzllamaFlutter.setUserName(username)

Update User Attributes (optional)

Attributes are additional data points about users, that are used for creating targeted user cohorts on the Blitzllama dashboard. Attributes are optional and not required to launch a micro-survey.

Allowed data_type values are "string", "number", "date", and "boolean".

BlitzllamaFlutter.setUserAttribute(attribute, attributeValue, dataType); 

Set User Language (optional)

You can provide Blitzllama with the language you wish to survey your user. It is not mandatory to launch surveys.

BlitzllamaFlutter.setSurveyLanguage("en");

Language code should be in ISO 639-1 codes.

Logout User (optional)

You can call this function if you wish to stop tracking the user.

BlitzllamaFlutter.logout();

3. Adding Triggers

Triggers, when initiated, display the micro-survey to the users. You can add triggers to all components - button press, screen open, or screen close - that are critical in a user's journey.

Make sure to create a user before triggering a survey.

BlitzllamaFlutter.triggerEvent(triggerName);

Last updated