You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What i have done:
I have added two Dio Clients for two different APIs
I have add these two lines for registering Dio Clients in Get It.
// First API (Dio Client)
_getIt.registerSingleton(DioClient().getDio());
// Second API (Dio Client)
_getIt.registerSingleton(DioAnotherClient().getDio());
I am Facing this error after doing this:
E/flutter (13845): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: Invalid argument(s): Object/factory with type Dio is already registered inside GetIt.
I am seeking a solution to Use Multiple APIs using GetIt & Dio Package.
Can anyone provide a solution to this issue?
The text was updated successfully, but these errors were encountered:
Hi,
it's actually very easy to fix for that case you have to provide different instanceNames when registerinf and use that too when you access the instances
Hi, it's actually very easy to fix for that case you have to provide different instanceNames when registerinf and use that too when you access the instances
Uh oh!
There was an error while loading. Please reload this page.
I am using Get It for State management for my Flutter App
I want to use multiple APIs with Dio Package.
What i have done:
I have added two Dio Clients for two different APIs
I have add these two lines for registering Dio Clients in Get It.
// First API (Dio Client)
_getIt.registerSingleton(DioClient().getDio());
// Second API (Dio Client)
_getIt.registerSingleton(DioAnotherClient().getDio());
I am Facing this error after doing this:
E/flutter (13845): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: Invalid argument(s): Object/factory with type Dio is already registered inside GetIt.
I am seeking a solution to Use Multiple APIs using GetIt & Dio Package.
Can anyone provide a solution to this issue?
The text was updated successfully, but these errors were encountered: