# \[Archive\] Web3Auth Flutter throws PlatformException on initialization

**URL:** https://builder.metamask.io/t/archive-web3auth-flutter-throws-platformexception-on-initialization/1200
**Category:** Embedded Wallets (Web3Auth)
**Created:** [October 13, 2024, 9:08am UTC](https://builder.metamask.io/t/archive-web3auth-flutter-throws-platformexception-on-initialization/1200 "2024-10-13T09:08:38Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![mayananand2](https://avatars.discourse-cdn.com/v4/letter/m/82dd89/32.png) [@mayananand2](https://builder.metamask.io/u/mayananand2)
#### Post date: [October 13, 2024, 9:08am UTC](https://builder.metamask.io/t/archive-web3auth-flutter-throws-platformexception-on-initialization/1200/1 "2024-10-13T09:08:38Z")

</div>

> **🏛 Archived Content from Web3Auth Community**
> 
> This topic was originally posted by **mayananand2** on 10/13/2024.  
> This content has been migrated from our previous community forum to preserve valuable discussions.

* * *

- SDK Version: 3.22.3
- Platform: Android Studio  
-web3auth\_flutter : ^5.0.3
- Browser Console Screenshots:
- If the issue is related to Custom Authentication, please include the following information (optional):
  - Verifier Name:
  - JWKS Endpoint:
  - Sample idToken (JWT):

web\_3\_auth\_initialization\_bloc.dart :

```auto
import 'package:bloc/bloc.dart' show Bloc, Emitter;
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:sky_ways/core/errors/failures/auth_failure.dart'
    show Web3AuthInitializationFailure;
import 'package:sky_ways/features/auth/domain/repositories/auth_repository.dart';
part ‘web_3_auth_initialization_event.dart’;
part ‘web_3_auth_initialization_state.dart’;
part ‘web_3_auth_initialization_bloc.freezed.dart’;
class Web3AuthInitializationBloc
extends Bloc<Web3AuthInitializationEvent, Web3AuthInitializationState> {
Web3AuthInitializationBloc(
AuthRepository authRepository,
) : _authRepository = authRepository,
super(
const Web3AuthInitializationState.initial(),
) {
on<_Initialize>(
_initialize,
);
}
final AuthRepository _authRepository;
Future<void> _initialize(
_Initialize _,
Emitter<Web3AuthInitializationState> emit,
) async {
emit(
const Web3AuthInitializationState.initializing(),
);
final result = await _authRepository.initializeWeb3Auth();

result.fold(
  (web3AuthInitializationFailure) =&gt; emit(
    Web3AuthInitializationState.failedToInitialize(
      web3AuthInitializationFailure: web3AuthInitializationFailure,
    ),
  ),
  (_) =&gt; emit(
    const Web3AuthInitializationState.initialized(),
  ),
);

```

web\_3\_auth\_initialization\_state.dart :

```auto
part of 'web_3_auth_initialization_bloc.dart';
@freezed
class Web3AuthInitializationState with _$Web3AuthInitializationState {
const factory Web3AuthInitializationState.initial() = _Initial;
const factory Web3AuthInitializationState.initializing() = _Initializing;
const factory Web3AuthInitializationState.initialized() = _Initialized;

```

web\_3\_auth\_initialization\_event.dart :

```auto
part of 'web_3_auth_initialization_bloc.dart';

```

While running the app, it freezes on the splash screen and the logs shows that the web3auth initialization failed. I have attached the screenshot of the logs for reference.

[![Screenshot 2024-10-13 at 2.37.49 PM](https://canada1.discourse-cdn.com/flex011/uploads/metamaskbuilderhub/original/1X/594608c3c752c5fab0b47f495e6bad5d6f0a8657.png)
Screenshot 2024-10-13 at 2.37.49 PM1906×1296 427 KB
](https://web3auth.io/community/uploads/default/original/2X/b/b48c39cae2fab9740648f62b76eecb5366e8a307.png "Screenshot 2024-10-13 at 2.37.49 PM")

---

<div class="post-metadata">

### Author: ![w3abot](https://avatars.discourse-cdn.com/v4/letter/w/4da419/32.png) [@w3abot](https://builder.metamask.io/u/w3abot)
#### Post date: [October 13, 2024, 9:09am UTC](https://builder.metamask.io/t/archive-web3auth-flutter-throws-platformexception-on-initialization/1200/2 "2024-10-13T09:09:43Z")

</div>

Hello Mayan,

Thank you for reaching out! I see you’re having trouble with the Web3Auth Flutter SDK throwing a `PlatformException` during initialization. Here are the details you’ve provided that I’ll pass along to our support team:

- **SDK Details** : PnP Flutter SDK
- **Issue** : Web3Auth Flutter throws PlatformException on initialization
- **SDK Version** : 3.22.3
- **Platform** : Android Studio
- **web3auth\_flutter Version** : ^5.0.3
- **Browser Console Screenshots** : (not provided)
- **Screen Recording** : Attached

From your description, it sounds like the app is freezing on the splash screen due to the initialization failure. If possible, please share any console logs related to the error when running the app. That might help us identify the issue more quickly.

Our support team will review this information and get back to you as soon as possible! In the meantime, you might consider checking if your authentication configurations (like clients or keys) are set up correctly.

If you have any other questions or need further assistance, feel free to ask. We’re here to help!

> Note: This response was generated by an AI bot and may require further verification. The Web3Auth support team has tracked this issue and will be responding as soon as possible.

---

<div class="post-metadata">

### Author: ![Ayush](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/ayush/32/1540_2.png) [@Ayush](https://builder.metamask.io/u/Ayush)
#### Post date: [October 14, 2024, 2:56am UTC](https://builder.metamask.io/t/archive-web3auth-flutter-throws-platformexception-on-initialization/1200/3 "2024-10-14T02:56:29Z")

</div>

Do you have a try and catch for the initialise function. The initialize function checks whether there is any active session present or not, and if the session is present it initialises the SDK with the active session, or else it’ll throw the error. So, you can handle the error in catch, and swallow it, it won’t create any issues.

---

<div class="post-metadata">

### Author: ![mayananand2](https://avatars.discourse-cdn.com/v4/letter/m/82dd89/32.png) [@mayananand2](https://builder.metamask.io/u/mayananand2)
#### Post date: [October 14, 2024, 12:04pm UTC](https://builder.metamask.io/t/archive-web3auth-flutter-throws-platformexception-on-initialization/1200/4 "2024-10-14T12:04:47Z")

</div>

[![Screenshot 2024-10-14 at 5.24.27 PM](https://canada1.discourse-cdn.com/flex011/uploads/metamaskbuilderhub/original/1X/bb8349493f7e76653783cd0206f7d7ff4878be6e.png)
Screenshot 2024-10-14 at 5.24.27 PM1710×154 23.4 KB
](https://web3auth.io/community/uploads/default/original/2X/3/366bc567de9638fa892e02136653e0a0c56cbb4c.png "Screenshot 2024-10-14 at 5.24.27 PM")

Well, the docs says it initializes the Web3Auth Flutter. So, slightly confusing to what you are stating.

---

<div class="post-metadata">

### Author: ![Ayush](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/ayush/32/1540_2.png) [@Ayush](https://builder.metamask.io/u/Ayush)
#### Post date: [October 14, 2024, 2:16pm UTC](https://builder.metamask.io/t/archive-web3auth-flutter-throws-platformexception-on-initialization/1200/5 "2024-10-14T14:16:51Z")

</div>

Hm, thanks for pointing out. We’ll update the code documentation. To init the SDK, you need to use the `init` method. The `initialize` method will help with the session management.

---

<div class="post-metadata">

### Author: ![mayananand2](https://avatars.discourse-cdn.com/v4/letter/m/82dd89/32.png) [@mayananand2](https://builder.metamask.io/u/mayananand2)
#### Post date: [October 17, 2024, 11:36am UTC](https://builder.metamask.io/t/archive-web3auth-flutter-throws-platformexception-on-initialization/1200/6 "2024-10-17T11:36:18Z")

</div>

My issue is still not resolved. I think i have initialized it properly. Also, it was working fine before. All of a sudden, it started showing the error in the logs and got stuck on the splash screen that too only on the Android emulator. Can you explain in a little detailed way?

[![Screenshot 2024-10-17 at 5.04.58 PM](https://canada1.discourse-cdn.com/flex011/uploads/metamaskbuilderhub/original/1X/f24693a6f2bb4a0fe902e6bcc26a7e37fd843a4d.jpeg)
Screenshot 2024-10-17 at 5.04.58 PM1262×1366 169 KB
](https://web3auth.io/community/uploads/default/original/2X/b/bb84a4b1655fdee40e4063638c809784d3baab54.jpeg "Screenshot 2024-10-17 at 5.04.58 PM")

---

<div class="post-metadata">

### Author: ![Ayush](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/ayush/32/1540_2.png) [@Ayush](https://builder.metamask.io/u/Ayush)
#### Post date: [October 18, 2024, 2:05am UTC](https://builder.metamask.io/t/archive-web3auth-flutter-throws-platformexception-on-initialization/1200/7 "2024-10-18T02:05:12Z")

</div>

Hey, we did debug, the fetch config project API was failing. We have fixed it, the hotfix will be available soon.

---

<div class="post-metadata">

### Author: ![Ayush](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/ayush/32/1540_2.png) [@Ayush](https://builder.metamask.io/u/Ayush)
#### Post date: [October 18, 2024, 4:30am UTC](https://builder.metamask.io/t/archive-web3auth-flutter-throws-platformexception-on-initialization/1200/8 "2024-10-18T04:30:44Z")

</div>

The API has been fixed, please check now.
