Example Solana in flutter not working and want web as well

When asking for help in this category, please make sure to provide the following details:

  • SDK Version: web3auth_flutter: ^3.1.3

  • Platform: Flutter

  • Browser Console Screenshots:

  • If the issue is related to Custom Authentication, please include the following information (optional):

    • Verifier Name:
    • JWKS Endpoint:
    • Sample idToken (JWT):

Also, kindly provide the Web3Auth initialization and login code snippet below. This will help us better understand your issue and provide you with the necessary assistance.

Hi, I’m looking to get web3auth integrated with flutter for Android, iOS, and web. And I want to set this up on the solana chain. Two questions I have:

1.) I’ve been using the provided example on the the github from the docs (https://github.com/Web3Auth/web3auth-pnp-examples/tree/main/flutter/flutter-solana-example) and I’ve tried to run it on my android emulator. I get to the login screen, but regardless of if I do the passwordless login or google login, my app just gets stuck and is spinning (see screenshot) after going through entering OTP (for passwordless) or logging in to my google account. Is there an issue with the example codebase? If so, what is the fix for this to get it working?
2.) I’ve noticed that nowhere in the documentations is web integration mentioned with Flutter specifically. I really also need my website setup with Flutter, so could someone provide some guidance as to how to integrate web in Flutter?

Any help appreciated. Thanks!

@service2 Welcome Aboard!

  1. I will have the example you shared checked by our Dev team and get back to you.

  2. I’m sorry to inform you that at this time, we do not have any plans to support Flutter Web. However, we will keep you updated if there are any changes in our plans regarding its support. Would you be down to exploring our JS SDK?

Hey @service2, the first issue is valid, and it’s because of the wrong configuration of AndroidManifest file. We have already identified and raised a PR with fix, it’ll land soon. Meanwhile, if you want to run, you can change the AndroidManifest file content to below.

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <application
        android:label="flutter_solana_example"
        android:name="${applicationName}"
        android:icon="@mipmap/ic_launcher">
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <!-- Specifies an Android theme to apply to this Activity as soon as
                 the Android process has started. This theme is visible to the user
                 while the Flutter UI initializes. After that, this theme continues
                 to determine the Window background behind the Flutter UI. -->
            <meta-data
              android:name="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/NormalTheme"
              />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
            <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="w3aexample" android:host="com.example.flutter_solana_example" android:path="/auth" />
            </intent-filter>
        </activity>
        <!-- Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    </application>
</manifest>
1 Like

Hi @Ayush @vjgee . I am now successfully able to get in and the flow is working as expected, thank you! I do still have couple question though on this Solana example code:

1.) I do see a successful address that is presented on the homescreen, but when I search it on Solana network (https://explorer.solana.com/?cluster=devnet) and I search the address, it says “Account does not exist”, see below screenshot. Here is my address for reference: FPcgGna3pcLuPfdEPoWcA5BVUXuZfqUotAc3wBXmesHJ

What is it missing? I tried changing the RPC URL on that page to custome RPC (https://api.devnet.solana.com) as well, but still same result. Is the app not getting the address correctly? Is this also because there’s no balance yet?

2.) I am able to login to the same email address using both passwordless and Google login, but both provide me a different address. And I assume different wallets are also created because they return me different addresses. Is there any way to prevent users from doing this? I only want one use in my app to have one wallet based on how they registered the first time.

3.) As of now, since there’s no native Flutter web support, is there any way to still implement it through flutter web, using the current web available APIs? Would someone be able to take a look at this and get some documentation together and see if an implementation for Flutter web is possible or a workaround? Because I’m sure I’m not the only one using Flutter for not just mobile, but also web.

Thanks again for the prompt response!

Hey @service2, glad to know it solves the issue.

  1. Yes, you assumption is correct. You need to have min balance for an account to be constituted in the validator storage. Any account with 0 balance are deleted from the validator storage, hence you are seeing the message, “Account does not exist”.

  2. When users uses different authentication method regardless of the same email, it will generated a new private key resulting into different account address.

  3. You can use the existing the SDKs through js-interop. We don’t have plan to document it, because it’s not ideal way to use without plugin and moreover increases maintenance required for the docs. If you want, you can help us add the Web support by contributing to our Flutter SDK.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.