injectable icon indicating copy to clipboard operation
injectable copied to clipboard

error after upgrading injectable from 2.3.2 to 2.4.0

Open Alireza-Bodaghi opened this issue 3 months ago • 3 comments

i tried to upgrade both the injectable and injectable_generator, but this issue arised. after upgrade: injectable 2.4.0 injectable_generator 2.6.1 flutter 3.16.1

error:

Note: meta is pinned to version 1.11.0 by flutter_test from the flutter SDK. See https://dart.dev/go/sdk-version-pinning for details. Because every version of flutter_test from sdk depends on meta 1.11.0 and injectable >=2.4.0 depends on meta ^1.12.0, flutter_test from sdk is incompatible with injectable >=2.4.0. So, because project depends on both injectable ^2.4.0 and flutter_test from sdk, version solving failed.

i just tried to workaround the above error with this: dependency_overrides: meta: ^1.12.0

the meta problem was solved. but again, i faced the same issue as before with injectable:

Target dart2js failed: ProcessException: Process exited abnormally with exit code 1:
lib/core/utils/injection.config.dart:180:10:
Error: The argument type 'MockLocalDataSource' can't be assigned to the parameter type 'LocalDataSource Function()'.
- 'MockLocalDataSource' is from 'package:project/core/base/data/base_local_data_source_mocks.dart' ('lib/core/base/data/base_local_data_source_mocks.dart').
- 'LocalDataSource' is from 'package:project/core/base/data/base_local_data_source.dart' ('lib/core/base/data/base_local_data_source.dart').
   _i49.MockLocalDataSource(),
        ^
lib/core/utils/injection.config.dart:188:43:
Error: The argument type 'AlertHandlerCubit' can't be assigned to the parameter type 'AlertHandlerCubit Function()'.
- 'AlertHandlerCubit' is from 'package:project/core/utils/alert_handler/alert_handler_cubit.dart' ('lib/core/utils/alert_handler/alert_handler_cubit.dart').
 gh.singleton<_i4.AlertHandlerCubit>(_i4.AlertHandlerCubit());
                                         ^`

i get above error even with injectable 2.3.5. it did not get meta version error. but i got the injection error again. it is only working properly with injectable 2.3.2

is there any solution to this?

Alireza-Bodaghi avatar Mar 26 '24 13:03 Alireza-Bodaghi