Flutter is a cross-platform that lets you create android and iOS apps from a single code base by using a modern, and reactive framework. These apps are built using Dart, a simple object-oriented programming language. The basic idea of Flutter revolves around widgets. Flutter entails its own ready-made widgets which appear native either to Android (Material Design) or iOS apps (Cupertino). Also, you can create customized widgets.

A comprehensive guide to integrating your apps with InviteReferrals. The new Flutter Plugin helps you to run a referral campaign in InviteReferrals. Read this guide to know the basic integration of the referral campaign, how to track the events, how to show a welcome message, and other important information via FAQs.
Read this guide to integrate your apps with InviteReferrals android SDK.

Add InviteReferrals Library to your Project

flutter pub add flutter_invitereferrals
/*this will add a line like this to your package's pubspec.yaml
    flutter_invitereferrals: ^1.0.1 

Initialize Sdk (Platform Specific)


A. Configure your AndroidManifest.xml

   <uses-permission android:name="android.permission.INTERNET" />
   <uses-permission android:name="android.permission.WAKE_LOCK" />
   <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
   <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
   <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
   <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
   <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
   <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
           android:value="10xxx" />
           android:value="C2C3xxxxxxxxxxxxxxxxxx" />


In the above example, Dummy Brand ID and Encryption keys shown. Kindly login your IR_account to see your credentials.

If you want to use contact_sync feature, then add the following permissions into your
manifest.xml file under manifest tag.

<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />

B. MainApplication class initialization

  1. If you don’t have your Application class (In Generally). Then add this line on your manifest.xml. Otherwise Skip this step and follow next.
  1. If you have the Application class, Initialized flutter-InviteReferrals plugin like this.

a. Import this statement

import com.flutter.invitereferrals.InviteReferralsPlugin;

b. Call invitereferrals register() method in onCreate() method



A. Run this command from terminal

cd ios && pod install && cd ..

B. Configure info.plist file

  • Goto Your_ProjectFolder >> ios and open Your_ProjectName.xcworkspace file into Xcode.
            <string>”yourURLscheme comes here”</string>
  • Goto info.plist of your project. Open info.plist file as source code (right click on info.plist and click on Open as >> Source code) and add the following code in it.


1.1. You can simply open the info.plist and add the keys which works as the same as above for this.
Add a new row by going to the menu and clicking Editor > Add Item. Setup a NSAppTransportSecurity as a Dictionary.

1.2. Add a new row again and set up a URL Types item by adding a new item. Expand the URL Types key, expand Item 0, and add a new item, URL schemes. Fill in “appScheme” for Item 0 of URL schemes and your company identifier for the URL Identifier. Your file should resemble the image below when done.

1.3. Add a new row again and set up a LSApplicationQueriesSchemes as an Array. Fill in “whatsapp” for Item 0 , “fb” for item 1 and “twitter” for item 2 as like following image.

C. App Delegate initialization

Import Invitereferrals header file. Just after defaults import statements.

#import <InviteReferrals.h>

Initialize the sdk in didFinishLaunchingWithOptions function.

[InviteReferrals setupWithBrandId: 10XX encryptedKey: @"C2C3B406726CXXXX0"];


- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
   [GeneratedPluginRegistrant registerWithRegistry:self];
   // Override point for customization after application launch.
   [InviteReferrals setupWithBrandId: 10209 encryptedKey: @"C2C3B406726C2F12F4401DF0BC232B00"];
   return [super application:application didFinishLaunchingWithOptions:launchOptions];

Add the following functions in your AppDelegate file. openURL function that will check the deep linking and open your app from the URL Scheme.

-(BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
   [InviteReferrals OpenUrlWithApplication: app Url: url];
   return YES;
-(BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler {
   [InviteReferrals continueUserActivityWith: userActivity];
   return YES;

Import invitereferrals package

Now in your Dart code, you can import the invitereferrals package

import 'package:flutter_invitereferrals/flutter_invitereferrals.dart';