Simple generate service locator using GetIt and clean architecture.
this library simplify the implementation and can inject the service locator in order
- Install get_it (https://pub.dev/packages/get_it)
- Install build_runner (https://pub.dev/packages/build_runner)
- this library support adding Repository, DataSource, and Service.
for example:
@AddRepositoryOf(services: [AuthRepository, UserInfoRepository], tag: "Remote")
class RemoteRepository implements AuthRepository, UserInfoRepository{
// some implementation...
}
- then run build_runner command:
flutter pub run build_runner build
- Then there will be a new file called
service_locator.g.dart
inside lib/