Skip to main content

Flutter

The Gleap SDK for Flutter is the easiest way to integrate Gleap into your apps. Communicate with your users directly and build better software by discovering their everyday pain points. Gleap is your all-in-one customer feedback tool for apps and websites.

For the SDK to work, you need an API key, which you can get for free at app.gleap.io.

Supported platforms

✅ iOS✅ Android✅ Web

🏗 Installation

Open a terminal window and navigate to the root folder of your iOS project.

Install the Gleap SDK

Run this command to add Gleap to your dependencies:

 flutter pub add gleap_sdk

Flutter v2 Support

If you are using Flutter < v3, please import the gleap_sdk as shown below:

dependencies:
gleap_sdk:
git:
url: https://github.com/GleapSDK/Flutter-SDK.git
ref: flutter-v2

iOS installation

Navigate to your iOS project folder within the terminal and update your cocoapods by running:

pod install

Android installation

Android should be already good to go. If theres a version conflict pls add the following to your android manifest:

<manifest ... xmlns:tools="http://schemas.android.com/tools">
<uses-sdk android:minSdkVersion="21"
tools:overrideLibrary="io.gleap.gleap_sdk"/>
<application .... tools:overrideLibrary="io.gleap.gleap_sdk">
...

Important: Always have a look at your minSdkVersion on android and your minimum target version on iOS to keep them on the same minimum version gleap needs.

Web installation

Navigate to your web project folder and insert the following snippet as first element within the head tag of your index.html

<script>
!function(Gleap,t,i){if(!(Gleap=window.Gleap=window.Gleap||[]).invoked){for(window.GleapActions=[],Gleap.invoked=!0,Gleap.methods=["identify","setEnvironment","setTags","attachCustomData","setCustomData","removeCustomData","clearCustomData","registerCustomAction","trackEvent","log","preFillForm","showSurvey","sendSilentCrashReport","startFeedbackFlow","startBot","setAppBuildNumber","setAppVersionCode","setApiUrl","setFrameUrl","isOpened","open","close","on","setLanguage","setOfflineMode","initialize","disableConsoleLogOverwrite","logEvent","hide","enableShortcuts","showFeedbackButton","destroy","getIdentity","isUserIdentified","clearIdentity","openConversations","openConversation","openHelpCenterCollection","openHelpCenterArticle","openHelpCenter","searchHelpCenter","openNewsArticle","openChecklists","startChecklist","openNews","openFeatureRequests","isLiveMode"],Gleap.f=function(e){return function(){var t=Array.prototype.slice.call(arguments);window.GleapActions.push({e:e,a:t})}},t=0;t<Gleap.methods.length;t++)Gleap[i=Gleap.methods[t]]=Gleap.f(i);Gleap.load=function(){var t=document.getElementsByTagName("head")[0],i=document.createElement("script");i.type="text/javascript",i.async=!0,i.src="https://sdk.gleap.io/latest/index.js",t.appendChild(i)},Gleap.load()}}();
</script>

Please note that you must need to run flutter clean and flutter pub get after adding the Gleap script to your index.html file.

Configure the SDK

The last step is to initialize & configure the Gleap SDK by adding the following code. If you want to add the Gleap SDK in your main.dart make sure to call WidgetsFlutterBinding.ensureInitialized(); before you initialize the Gleap SDK.

Gleap.initialize(token: 'YOUR_API_KEY');

Congratulations 🎉 You are all set 👋

🤝 Need help?

We are here to help! [email protected]