Skip to main content

Flutter

With AppKit Flutter, you can easily let people interact with multiple EVM compatible wallets and blockchains.

Let's get started with the installation and configuration!

Installation

    • Add reown_appkit as dependency in your pubspec.yaml and run flutter pub get (check out the latest version)
    • Or simply run flutter pub add reown_appkit
    • Locate your /ios/Podfile file and add the following as the first line:
platform :ios, '13.0'
    • Run $ pod install inside /ios folder.
    • You should now be able to run your app with flutter run --dart-define=PROJECT_ID={your_project_id}

Enable Installed Wallet Detection

To enable AppKit to detect installed wallets on the device, you need to make specific changes to the native sides of the project.

  1. Open your Info.plist file.
  2. Locate the <key>LSApplicationQueriesSchemes</key> section.
  3. Add the desired wallet schemes as string entries within the <array>. These schemes represent the wallets you want to detect.
  4. Refer to our Info.plist example file for a detailed illustration.

Example:

<key>LSApplicationQueriesSchemes</key>
<array>
<string>metamask</string>
<string>trust</string>
<string>safe</string>
<string>rainbow</string>
<!-- Add other wallet schemes names here -->
</array>

Coinbase Wallet support

Coinbase Wallet does not use the WalletConnect protocol for communication between the dApp and the wallet.

This means that pairing topic, session topic, session events and other session-related features are not available when connecting to Coinbase Wallet.

However, you can still enable it to seamlessly connect with your dApp with these additional steps.

If you still want to support it, on your iOS and Android native side make the following changes:

  1. Open your Info.plist file.
  2. Locate the <key>LSApplicationQueriesSchemes</key> section.
  3. Include <string>cbwallet</string> scheme as mentioned above in previous section

Example:

<key>LSApplicationQueriesSchemes</key>
<array>
<string>cbwallet</string>
<!-- Any other scheme previously added -->
</array>
  1. Make sure pods are installed, otherwise run pod install inside your /ios folder.
  2. Open your /ios/Runner.xcworkspace file with Xcode and add the following code in AppDelegate.swift file:
import CoinbaseWalletSDK
override func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
if #available(iOS 13.0, *) {
if (CoinbaseWalletSDK.isConfigured == true) {
if (try? CoinbaseWalletSDK.shared.handleResponse(url)) == true {
return true
}
}
}

return super.application(app, open: url, options: options)
}

override func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
if #available(iOS 13.0, *) {
if (CoinbaseWalletSDK.isConfigured == true) {
if let url = userActivity.webpageURL,
(try? CoinbaseWalletSDK.shared.handleResponse(url)) == true {
return true
}
}
}

return super.application(application, continue: userActivity, restorationHandler: restorationHandler)
}

Checkout out the AppDelegate.swift file from our sample dapp for reference.

Disable Coinbase Wallet

Coinbase Wallet is enabled by default even if, in order to function properly, a few steps has to be done as described in the previous section. However, if you don't want to include/support Coinbase Wallet on your app you just need to pass Coinbase Wallet id fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa to excludedWalletIds options Array.


Phantom Wallet support

important note

Phantom Wallet support is available from reown_appkit: ^1.4.0-beta02 and is currently in beta. Any feedback is appreciated.

Phantom Wallet does not use the WalletConnect protocol for communication between the dApp and the wallet, instead it provides an internal API mechanism based on deep/universal links.

This means that pairing topic, session topic, session events and other session-related features are not available when connecting to Phantom Wallet and the interaction is really basic. Dapp sends a request, Phantom Wallet responds. That's all.

Furthermore, Phantom Wallet deep/universal links mechanism supports interaction only with Solana blockchain.

In order to support Phantom Wallet interactions a few extra steps has to be performed, only if you haven't implemented Link Mode already.

  1. First, be sure you already have your redirection back configuration properly set in place. See Redirect to your dApp

  2. Then you will have to implement your own Depp Link mechanism on Flutter side and when a link is received through it, you just call await _appKitModal.dispatchEnvelope(link);

    As an example you can see how we do it on our Sample Dapp by following...

Constructing a Solana transaction would depend of the library/package of your choice but in our sample dApp's code you can see how we do it using solana_web3 package.

Disable Phantom Wallet

Phantom Wallet is enabled by default even if, in order to function properly, a few steps has to be done as described in the previous section. However, if you don't want to include/support Phantom Wallet on your app you just need to pass Phantom Wallet id a797aa35c0fadbfc1a53e7f675162ed5226968b44a19ee3d24385c64d1d3c393 to excludedWalletIds options Array.

Example

Test Apps

Want to see AppKit in action? Download our sample AppKit apps below and explore what it can do. Enjoy! 😊