Closed Dr-Legend closed 4 years ago
It looks like you have two versions of IClient
'IClient/1/' is from 'lib/utils/network/base_client.dart'.
'IClient/2/' is from 'package:pressy_admin/utils/network/base_client.dart'
('lib/utils/network/base_client.dart').
client: services.getService(),
^
lib/main.dart:66:24:
Error: The argument type 'IClient/1/' can't be assigned to the parameter type 'IClient/2/'.
While they might look the same the compiler thinks they are different.
Perhaps you are referring to IClient using a relative url somewhere 'lib/utils/network/base_client.dart' but a package url somewhere else 'package:pressy_admin/utils/network/base_client.dart'
Also are you missing a Type parameter from all your services.getService()
calls. Should it be for example
@override
IService getService<TType>({String key}) =>
_injector.get<TType>(key: key);
}
The injector won't know what type of service you want it go get.
So instead of this (which you are currently doing)
services.addScoped((services) => AuthDataSourceImpl(
apiEndpointProvider: services.getService(),
client: services.getService(),
authSession: services.getService()));
You would do this
services.addScoped((services) => AuthDataSourceImpl(
apiEndpointProvider: services.getService<ApiEndpointProvider>(),
client: services.getService<HttpClient>(),
authSession: services.getService<AuthSessionImpl>()));
Without providing the base type for instance a AuthSession
to register a AuthSessionImpl
against you are losing the typing ability to separate base types from super type (if that is your desired route which I think it might be looking at your naming convention.
Closing due to lack of response
getting this error whenever i build for web using "flutter build web" ➜ pressy_admin git:(master) ✗ flutter build web Running "flutter pub get" in pressy_admin... 0.6s
0 Dart2JSTarget.build (package:flutter_tools/src/build_system/targets/web.dart:154:7)