Skip to main content

Installing PnP Flutter SDK

Installation

To install the Web3Auth Flutter package, you have two options. You can either manually add the package in the pubspec.yaml file, or you can use the flutter pub add command.

Add web3auth_flutter as a dependency to your pubspec.yaml.

dependencies:
web3auth_flutter: ^5.0.4

Add web3auth_flutter using flutter pub add command.

flutter pub add web3auth_flutter

Android Configuration

Once we have installed Web3Auth Flutter SDK, we also need to add the configuration for Android.

Update compileSdkVersion

For Android build compileSdkVersion needs to be 34. Check your app module gradle file in your project to change it.

android {
namespace "com.example.app_name"
compileSdkVersion 34
// ..
}

Add Web3Auth to Gradle

In your project-level gradle file add JitPack repository.

dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url "https://jitpack.io" } // <-- Add this line
}
}

Update Permissions

Open your app's AndroidManifest.xml file and add the following permission. Please make sure the <uses-permission> element should be a direct child of the <manifest> root element.

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

Configure Redirection

Once the gradles and permission has been updated, you need to configure Web3Auth project by whitelisting your scheme and package name.

Configure Web3Auth project

  • Go to Web3Auth Developer Dashboard, and create or open an existing Web3Auth project.
  • Whitelist {SCHEME}://{YOUR_APP_PACKAGE_NAME} in the developer dashboard. This step is mandatory for the redirect to work.

Open your app's AndroidManifest.xml file and add the following deep link intent filter to your Main activity

<intent-filter>
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data android:scheme="{scheme}" android:host="{YOUR_APP_PACKAGE_NAME}" android:path="/path" />
<!-- Accept URIs: w3a://com.example.w3aflutter -->
</intent-filter>

iOS Configuration

Once we have configured the Android SDK, we also need add the configuration for iOS.

Update global iOS platform

For iOS build global platform needs to be 14.0. Check Podfile in your project to change the global platform.

platform :ios, '14.0'

Configure Redirection

To use Web3Auth for iOS you need to Whitelist your bundleId in your Web3Auth project.

  • Go to Web3Auth Developer Dashboard, and create or open an existing Web3Auth project.
  • Whitelist (bundleId)://auth in the developer dashboard. This step is mandatory for the redirect to work.