Questions tagged [injectable]

121 questions
1
vote
1 answer

JMockit's @Injectable for non-Autowired fields

I have a class in which some fields are @Autowired and some are not, and in the test class I would like to auto-inject values not only for the @Autowired fields. But the auto injection occurs only for @Autowired fields. Here is an example: public…
Dikla
  • 3,461
  • 5
  • 30
  • 43
0
votes
0 answers

Error when unit testing Angular service decorated with Injectable

I have an angular service, very simple inside. I wrote couple of unit tests and my Jasmine/Karma runner throws errors lile: Uncaught TypError: (0, tslib_WEBPACK_IMPORTED_MODULE_0__.__decorate) is not a function... After some investigation I…
vanpersil
  • 764
  • 1
  • 8
  • 26
0
votes
0 answers

How to use service to an other service with Injectable and different Value in NestJs?

I have a problem in Nest.js: think about it you have 3 module in nest that name is (a1,b1,c1) (c1) is a class and have a constructor(name,age,lastName) this code is: @Injectable() export class Cservice { private name: string; private lastName:…
0
votes
0 answers

Comparison Flutter GetIt vs GetX

as I have read article and find out about dependency injection, I found 2 most popular library for dependency injection. GetIt with Injectable GetX I know that GetX library is usefull for Routing, State Management too. But in this comparison, I…
0
votes
0 answers

GetIt instance creation fails at startup

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: 'package:get_it/get_it_impl.dart': Failed assertion: line 333 pos 7: 'type != null || const Object() is! T': GetIt: The compiler could not infer the type. You have to provide a…
0
votes
1 answer

How to change the dependency at runtime using the flutter injectable library?

I am developing a flutter application that uses injectable and get_it libraries. And I have a Dio reference that contains Auth token which is getting from the LocaleStorage service. When I change it at runtime it is not getting updated. Because of…
haliltprkk
  • 1,428
  • 3
  • 14
  • 26
0
votes
1 answer

Flutter Injectable package is not generating code for multiple factory methods in a class

I am trying to create instance of AuthBloc by named constructer using GetIt and Injectable (Used for Dependancy Injection) package. But the code generated is only for one factoryMethod or one named constructor. @injectable class AuthBloc extends…
0
votes
1 answer

Flutter Injectable - Object/factory with type xxxxx is not registered inside GetIt

Im trying to use flutter plugin 'Injectable' but i got this error. This error keeps coming even after having tried all the possible solutions provided in other questions he following assertion was thrown building SignInPage(dirty, state:…
0
votes
0 answers

How to make sure flutter build_runner includes files in the test/* folder?

I am using getIt with injectable for dependency injection. I have some mocks created with mockito that I am trying to inject as a substitute for my actual repository, but when I run the build runner, they are not showing up in the generated…
Charlie Page
  • 541
  • 2
  • 17
0
votes
0 answers

Which one is more performant in NestJS: adding a class instance in context or using @Injectable(scope:scope.REQUEST)

To implement Dataloader in NestJS application with GraphQl, to avoid caching, we need to limit the created dataloader instance to every single request. Can you guys help me have better understaning of differences between this two approach: adding…
Saeed
  • 1
0
votes
0 answers

Flutter Injectable and Retrofit

Trying to use retrofit with injectable but can´t implement because when I put "@Singleton" annotation on the generated retrofit code, it gets immediately deleted on save. This is original the code: part 'api_service.g.dart'; @RestApi(baseUrl:…
0
votes
1 answer

Dio interceptor not working with dependency injection

I'm trying to use Retrofit as my remote API client. I implement dependency injection in my project with Injectable, then I register the Dio class like this. @singleton class TSApiDio extends DioForNative { TSApiDio() { _configureOptions(); …
0
votes
2 answers

is not Injectable decorator required in providers?

I'm studying NestJS with a sample app. https://github.com/nestjs/nest/tree/master/sample/12-graphql-schema-first However, what I am curious about is that even if the service does not have an injectable decorator, it can be registered as a provider…
JoonDong
  • 109
  • 1
  • 8
0
votes
1 answer

Flutter: How to implement non-standard code flow using `injectable` package?

Let's say I need this: class EndpointProvider { String getEndpoint(String trigger) { // skipped for clarity } } class MyHttpClient implements BaseHttpClient { MyHttpClient(this.baseUrl, [String accessToken = '']); } class…
BambinoUA
  • 6,126
  • 5
  • 35
  • 51
0
votes
1 answer

Angular Reactive form injectable

i have a question regarding a problem i'm facing so far I've developed a small utility component which works as generic "error display component". export class ShowErrorComponent { // path refering to the form-element @Input('path') controlPath…
1 2 3
8 9