Open herman-the-worm opened 11 months ago
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions
I have the same problem. Is there a solution?
I was wondering exactly the same any tips or solution on that issue ?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions
Example of the project
-- lib/main.dart -- packages/authentication_repository/lib/authentication_repository.dart
lib/main.dart with AuthenticationBloc or any other class that depends on the Repository class (like AuthenticationRepository) which is exposed as an local package.
I have marked AuthenticationRepository class with @injectable
I have also included code snippet above AuthenticationRepository annotation
It looks like this
@microPackageInit void initAuthenticationRepository() {} // Needed for code generation
/// {@template authentication_repository} /// Repository which manages user authentication. /// {@endtemplate} @injectable class AuthenticationRepository {
import 'package:authentication_repository/authentication_repository.dart'; import 'package:checkmybuilding/shared/helper/get_it_service_locator.config.dart'; import 'package:get_it/get_it.dart'; import 'package:injectable/injectable.dart';
final getIt = GetIt.instance;
@InjectableInit( initializerName: r'$initGetIt', preferRelativeImports: true, includeMicroPackages: true, asExtension: false, generateForDir: [ 'lib', 'packages/authentication_repository/lib', ], externalPackageModulesBefore: [ ExternalModule(AuthenticationRepositoryPackageModule), ], )
But in this case I have to rebuild package in "authentication_repository" using build runner. It generates a file authentication_repository.module.dart. I have to include It in exports for the module and then import aforementioned file in the main.dart
Is there a way to automate this to build automatically for the dependent packages?
I am trying to understand if I am doing this correctly.
I would love to build a modular app and in the past (2 years ago) it was not possible with injectable and getIt but with this snippet of documentation I hope that it will be possible.
Thanks @Milad-Akarie